From 1c9cc33902d8242ec25b4416a1662ee6c9902583 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 28 Jul 2019 12:50:10 +0200 Subject: [PATCH 1/6] Try to localise timestamps I'm not sure, if that is the right way, but Qt doesn't really have a way to format custom localised dates, so I tried to find the closest approximations to what we currently have. Relates to #69 --- resources/langs/nheko_de.ts | 101 +++++++++++++++++++++++++------- resources/langs/nheko_el.ts | 101 +++++++++++++++++++++++++------- resources/langs/nheko_en.ts | 101 +++++++++++++++++++++++++------- resources/langs/nheko_fr.ts | 101 +++++++++++++++++++++++++------- resources/langs/nheko_nl.ts | 101 +++++++++++++++++++++++++------- resources/langs/nheko_pl.ts | 101 +++++++++++++++++++++++++------- resources/langs/nheko_ru.ts | 103 ++++++++++++++++++++++++++------- resources/langs/nheko_zh_CN.ts | 101 +++++++++++++++++++++++++------- src/Utils.cpp | 20 +++---- src/dialogs/MemberList.cpp | 4 +- src/dialogs/ReadReceipts.cpp | 12 ++-- src/timeline/TimelineItem.cpp | 2 +- src/ui/InfoMessage.cpp | 13 +++-- 13 files changed, 668 insertions(+), 193 deletions(-) diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index f592a4d8..8c92c084 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -4,7 +4,7 @@ AudioItem - + Save File In Datei speichern @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. Hochladen der Bilddatei fehlgeschlagen. Bitte versuche es erneut. @@ -32,7 +32,7 @@ Hochladen der Videodatei fehlgeschlagen. Bitte versuche es erneut. - + Failed to restore OLM account. Please login again. Wiederherstellung des OLM Accounts fehlgeschlagen. Bitte logge dich erneut ein. @@ -42,7 +42,7 @@ Nachrichten konnten nicht aus dem Cache geladen werden. Bitte melde dich erneut an. - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. Erstellung des Schlüsselmaterials fehlgeschlagen. Antwort des Servers: %1 %2. Bitte versuche es später erneut. @@ -118,7 +118,7 @@ FileItem - + Save File Datei speichern @@ -126,7 +126,7 @@ ImageItem - + Save image Bild speichern @@ -205,8 +205,8 @@ Teilnehmerliste - - ESC + + OK @@ -277,7 +277,7 @@ RoomInfo - + no version stored @@ -285,12 +285,12 @@ RoomInfoListItem - + Leave room Raum verlassen - + Accept Akzeptieren @@ -331,7 +331,7 @@ StatusIndicator - + Encrypted @@ -354,13 +354,13 @@ TextInputWidget - + Send a file - + Write a message... Schreibe eine Nachricht... @@ -424,7 +424,12 @@ - + + Mentions + + + + Invite users Benutzer einladen @@ -460,7 +465,7 @@ TypingDisplay - + is typing tippt @@ -481,7 +486,7 @@ UserSettingsPage - + Minimize to tray Ins Benachrichtigungsfeld minimieren @@ -521,12 +526,17 @@ - + Font Family - + + Emoji Font Famly + + + + Theme Erscheinungsbild @@ -566,7 +576,7 @@ ALLGEMEINES - + Open Sessions File @@ -635,6 +645,14 @@ ANMELDEN + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -778,7 +796,7 @@ Medien-Größe: %2 dialogs::ReadReceipts - + Read receipts Lesebestätigungen @@ -793,6 +811,19 @@ Medien-Größe: %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1003,4 +1034,32 @@ Medien-Größe: %2 Flaggen + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index 5a6be4cb..74b14266 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -4,7 +4,7 @@ AudioItem - + Save File Αποθήκευση @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. @@ -32,7 +32,7 @@ - + Failed to restore OLM account. Please login again. @@ -42,7 +42,7 @@ - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. @@ -118,7 +118,7 @@ FileItem - + Save File Αποθήκευση @@ -126,7 +126,7 @@ ImageItem - + Save image Αποθήκευση Εικόνας @@ -205,8 +205,8 @@ Μέλη - - ESC + + OK @@ -277,7 +277,7 @@ RoomInfo - + no version stored @@ -285,12 +285,12 @@ RoomInfoListItem - + Leave room Βγές - + Accept Αποδοχή @@ -331,7 +331,7 @@ StatusIndicator - + Encrypted @@ -354,13 +354,13 @@ TextInputWidget - + Send a file - + Write a message... Γράψε ένα μήνυμα... @@ -424,7 +424,12 @@ - + + Mentions + + + + Invite users Προσκάλεσε χρήστες @@ -460,7 +465,7 @@ TypingDisplay - + is typing πληκτρολογεί @@ -481,7 +486,7 @@ UserSettingsPage - + Minimize to tray Ελαχιστοποίηση @@ -521,12 +526,17 @@ - + Font Family - + + Emoji Font Famly + + + + Theme Φόντο @@ -566,7 +576,7 @@ ΓΕΝΙΚΑ - + Open Sessions File @@ -635,6 +645,14 @@ ΕΙΣΟΔΟΣ + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -776,7 +794,7 @@ Media size: %2 dialogs::ReadReceipts - + Read receipts @@ -791,6 +809,19 @@ Media size: %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1001,4 +1032,32 @@ Media size: %2 Σημαίες + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index d8259dc5..5c4bad0e 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -4,7 +4,7 @@ AudioItem - + Save File Save File @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. Failed to upload image. Please try again. @@ -32,7 +32,7 @@ Failed to upload video. Please try again. - + Failed to restore OLM account. Please login again. Failed to restore OLM account. Please login again. @@ -42,7 +42,7 @@ Failed to restore save data. Please login again. - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. Failed to setup encryption keys. Server response: %1 %2. Please try again later. @@ -118,7 +118,7 @@ FileItem - + Save File Save File @@ -126,7 +126,7 @@ ImageItem - + Save image Save image @@ -205,8 +205,8 @@ Room members - - ESC + + OK @@ -277,7 +277,7 @@ RoomInfo - + no version stored no version stored @@ -285,12 +285,12 @@ RoomInfoListItem - + Leave room Leave room - + Accept Accept @@ -331,7 +331,7 @@ StatusIndicator - + Encrypted @@ -354,13 +354,13 @@ TextInputWidget - + Send a file - + Write a message... @@ -424,7 +424,12 @@ - + + Mentions + + + + Invite users @@ -460,7 +465,7 @@ TypingDisplay - + is typing @@ -481,7 +486,7 @@ UserSettingsPage - + Minimize to tray @@ -521,12 +526,17 @@ - + Font Family - + + Emoji Font Famly + + + + Theme @@ -566,7 +576,7 @@ - + Open Sessions File @@ -635,6 +645,14 @@ + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -776,7 +794,7 @@ Media size: %2 dialogs::ReadReceipts - + Read receipts @@ -791,6 +809,19 @@ Media size: %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1001,4 +1032,32 @@ Media size: %2 Flags + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index beab8752..f8425e26 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -4,7 +4,7 @@ AudioItem - + Save File Enregistrer le fichier @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. @@ -32,7 +32,7 @@ - + Failed to restore OLM account. Please login again. @@ -42,7 +42,7 @@ - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. @@ -118,7 +118,7 @@ FileItem - + Save File Enregistrer le fichier @@ -126,7 +126,7 @@ ImageItem - + Save image Enregistrer l'image @@ -205,8 +205,8 @@ Membres du salon - - ESC + + OK @@ -278,7 +278,7 @@ RoomInfo - + no version stored @@ -286,12 +286,12 @@ RoomInfoListItem - + Leave room Quitter le salon - + Accept Accepter @@ -332,7 +332,7 @@ StatusIndicator - + Encrypted @@ -355,13 +355,13 @@ TextInputWidget - + Send a file - + Write a message... Écrivez un message... @@ -425,7 +425,12 @@ - + + Mentions + + + + Invite users Inviter des utilisateurs @@ -461,7 +466,7 @@ TypingDisplay - + is typing est en train d'écrire @@ -482,7 +487,7 @@ UserSettingsPage - + Minimize to tray Réduire à la barre des tâches @@ -522,12 +527,17 @@ - + Font Family - + + Emoji Font Famly + + + + Theme Thème @@ -567,7 +577,7 @@ GÉNÉRAL - + Open Sessions File @@ -636,6 +646,14 @@ CONNEXION + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -779,7 +797,7 @@ Taille du média : %2 dialogs::ReadReceipts - + Read receipts Accusés de lecture @@ -794,6 +812,19 @@ Taille du média : %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1004,4 +1035,32 @@ Taille du média : %2 Drapeaux + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index 4c81ec76..51ec18fe 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -4,7 +4,7 @@ AudioItem - + Save File Bestand opslaan @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. @@ -32,7 +32,7 @@ - + Failed to restore OLM account. Please login again. @@ -42,7 +42,7 @@ - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. @@ -118,7 +118,7 @@ FileItem - + Save File Bestand opslaan @@ -126,7 +126,7 @@ ImageItem - + Save image Afbeelding opslaan @@ -205,8 +205,8 @@ Kamerleden - - ESC + + OK @@ -277,7 +277,7 @@ RoomInfo - + no version stored @@ -285,12 +285,12 @@ RoomInfoListItem - + Leave room Kamer verlaten - + Accept Accepteren @@ -331,7 +331,7 @@ StatusIndicator - + Encrypted @@ -354,13 +354,13 @@ TextInputWidget - + Send a file - + Write a message... Typ een bericht... @@ -424,7 +424,12 @@ - + + Mentions + + + + Invite users Gebruikers uitnodigen @@ -460,7 +465,7 @@ TypingDisplay - + is typing is aan het typen @@ -481,7 +486,7 @@ UserSettingsPage - + Minimize to tray Minimaliseren naar systeemvak @@ -521,12 +526,17 @@ - + Font Family - + + Emoji Font Famly + + + + Theme Thema @@ -566,7 +576,7 @@ ALGEMEEN - + Open Sessions File @@ -635,6 +645,14 @@ INLOGGEN + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -778,7 +796,7 @@ Mediagrootte: %2 dialogs::ReadReceipts - + Read receipts Leesbevestigingen @@ -793,6 +811,19 @@ Mediagrootte: %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1003,4 +1034,32 @@ Mediagrootte: %2 Vlaggen + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index edea85b9..ca021554 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -4,7 +4,7 @@ AudioItem - + Save File Zapisz plik @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. Nie udało się wysłać obrazu. Spróbuj ponownie. @@ -32,7 +32,7 @@ Nie udało się wysłać filmu. Spróbuj ponownie. - + Failed to restore OLM account. Please login again. Nie udało się przywrócić konta OLM. Spróbuj zalogować się ponownie. @@ -42,7 +42,7 @@ Nie udało się przywrócić zapisanych danych. Spróbuj zalogować się ponownie. - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. @@ -118,7 +118,7 @@ FileItem - + Save File Zapisz plik @@ -126,7 +126,7 @@ ImageItem - + Save image Zapisz obraz @@ -205,8 +205,8 @@ Członkowie pokoju - - ESC + + OK @@ -277,7 +277,7 @@ RoomInfo - + no version stored @@ -285,12 +285,12 @@ RoomInfoListItem - + Leave room Opuść pokój - + Accept Akceptuj @@ -331,7 +331,7 @@ StatusIndicator - + Encrypted Szyfrowana @@ -354,13 +354,13 @@ TextInputWidget - + Send a file Wyślij plik - + Write a message... Napisz wiadomość… @@ -424,7 +424,12 @@ Ustawienia pokoju - + + Mentions + + + + Invite users Zaproś użytkowników @@ -460,7 +465,7 @@ TypingDisplay - + is typing pisze @@ -481,7 +486,7 @@ UserSettingsPage - + Minimize to tray Zminimalizuj do paska zadań @@ -521,12 +526,17 @@ - + Font Family - + + Emoji Font Famly + + + + Theme Motyw @@ -566,7 +576,7 @@ OGÓLNE - + Open Sessions File @@ -635,6 +645,14 @@ ZALOGUJ SIĘ + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -778,7 +796,7 @@ Rozmiar multimediów: %2 dialogs::ReadReceipts - + Read receipts Potwierdzenia przeczytania @@ -793,6 +811,19 @@ Rozmiar multimediów: %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1006,4 +1037,32 @@ Rozmiar multimediów: %2 Flagi + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index 4c157884..39cf7b72 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -4,7 +4,7 @@ AudioItem - + Save File Сохранить файл @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. Не удалось загрузить изображение. Пожалуйста, попробуйте еще раз. @@ -32,7 +32,7 @@ Не удалось загрузить видео. Пожалуйста, попробуйте еще раз. - + Failed to restore OLM account. Please login again. Не удалось восстановить учетную запись OLM. Пожалуйста, войдите снова. @@ -42,7 +42,7 @@ Не удалось восстановить сохраненные данные. Пожалуйста, войдите снова. - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. Не удалось настроить ключи шифрования. Ответ сервера:%1 %2. Пожалуйста, попробуйте позже. @@ -118,7 +118,7 @@ FileItem - + Save File Сохранить файл @@ -126,7 +126,7 @@ ImageItem - + Save image Сохранить изображение @@ -205,9 +205,9 @@ Участники комнаты - - ESC - + + OK + @@ -277,7 +277,7 @@ RoomInfo - + no version stored @@ -285,12 +285,12 @@ RoomInfoListItem - + Leave room Покинуть комнату - + Accept Принять @@ -331,7 +331,7 @@ StatusIndicator - + Encrypted Зашифровано @@ -354,13 +354,13 @@ TextInputWidget - + Send a file Отправить файл - + Write a message... Написать сообщение... @@ -424,7 +424,12 @@ Настройки комнаты - + + Mentions + + + + Invite users Пригласить пользователей @@ -460,7 +465,7 @@ TypingDisplay - + is typing печатает @@ -481,7 +486,7 @@ UserSettingsPage - + Minimize to tray Сворачивать в системную панель @@ -521,12 +526,17 @@ Размер шрифта - + Font Family - + + Emoji Font Famly + + + + Theme Тема @@ -566,7 +576,7 @@ ГЛАВНОЕ - + Open Sessions File Открыть файл сеансов @@ -636,6 +646,14 @@ ВХОД + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -779,7 +797,7 @@ Media size: %2 dialogs::ReadReceipts - + Read receipts Подтверждать прочтение @@ -794,6 +812,19 @@ Media size: %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1005,4 +1036,32 @@ Media size: %2 + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index ca7c6e22..08463cd7 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -4,7 +4,7 @@ AudioItem - + Save File 保存文件 @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. 上传图像失败。请重试。 @@ -32,7 +32,7 @@ 上传视频失败。请重试。 - + Failed to restore OLM account. Please login again. 恢复 OLM 账户失败。请重新登录。 @@ -42,7 +42,7 @@ 恢复保存的数据失败。请重新登录。 - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. @@ -118,7 +118,7 @@ FileItem - + Save File 保存文件 @@ -126,7 +126,7 @@ ImageItem - + Save image 保存图像 @@ -205,8 +205,8 @@ 聊天室成员 - - ESC + + OK @@ -277,7 +277,7 @@ RoomInfo - + no version stored @@ -285,12 +285,12 @@ RoomInfoListItem - + Leave room 离开聊天室 - + Accept 接受 @@ -331,7 +331,7 @@ StatusIndicator - + Encrypted 加密的 @@ -354,13 +354,13 @@ TextInputWidget - + Send a file 发送一个文件 - + Write a message... 写一条消息... @@ -424,7 +424,12 @@ 聊天室选项 - + + Mentions + + + + Invite users 邀请用户 @@ -460,7 +465,7 @@ TypingDisplay - + is typing 正在打字 @@ -481,7 +486,7 @@ UserSettingsPage - + Minimize to tray 最小化至托盘 @@ -521,12 +526,17 @@ - + Font Family - + + Emoji Font Famly + + + + Theme 主题 @@ -566,7 +576,7 @@ 通用 - + Open Sessions File 打开会话文件 @@ -635,6 +645,14 @@ 登录 + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -778,7 +796,7 @@ Media size: %2 dialogs::ReadReceipts - + Read receipts 阅读回执 @@ -793,6 +811,19 @@ Media size: %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1012,4 +1043,32 @@ Media size: %2 Flags + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + diff --git a/src/Utils.cpp b/src/Utils.cpp index d6b092b1..a3c15c96 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -99,13 +99,13 @@ utils::descriptiveTime(const QDateTime &then) const auto days = then.daysTo(now); if (days == 0) - return then.toString("HH:mm"); + return then.time().toString(Qt::DefaultLocaleShortDate); else if (days < 2) - return QString("Yesterday"); - else if (days < 365) - return then.toString("dd/MM"); + return QString(QCoreApplication::translate("descriptiveTime", "Yesterday")); + else if (days < 7) + return then.toString("dddd"); - return then.toString("dd/MM/yy"); + return then.date().toString(Qt::DefaultLocaleShortDate); } DescInfo @@ -147,7 +147,7 @@ utils::getMessageDescription(const TimelineEvent &event, DescInfo info; if (sender == localUser) - info.username = "You"; + info.username = QCoreApplication::translate("utils", "You"); else info.username = username; @@ -366,16 +366,16 @@ utils::getQuoteBody(const RelatedInfo &related) return markdownToHtml(related.quoted_body); } case MsgType::File: { - return QString("sent a file."); + return QString(QCoreApplication::translate("utils", "sent a file.")); } case MsgType::Image: { - return QString("sent an image."); + return QString(QCoreApplication::translate("utils", "sent an image.")); } case MsgType::Audio: { - return QString("sent an audio file."); + return QString(QCoreApplication::translate("utils", "sent an audio file.")); } case MsgType::Video: { - return QString("sent a video"); + return QString(QCoreApplication::translate("utils", "sent a video")); } default: { return related.quoted_body; diff --git a/src/dialogs/MemberList.cpp b/src/dialogs/MemberList.cpp index f4167143..3b957c15 100644 --- a/src/dialogs/MemberList.cpp +++ b/src/dialogs/MemberList.cpp @@ -97,7 +97,7 @@ MemberList::MemberList(const QString &room_id, QWidget *parent) topLabel_->setAlignment(Qt::AlignCenter); topLabel_->setFont(font); - auto okBtn = new QPushButton("OK", this); + auto okBtn = new QPushButton(tr("OK"), this); auto buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing(15); @@ -126,7 +126,7 @@ MemberList::MemberList(const QString &room_id, QWidget *parent) qCritical() << e.what(); } - auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this); + auto closeShortcut = new QShortcut(QKeySequence("ESC"), this); connect(closeShortcut, &QShortcut::activated, this, &MemberList::close); connect(okBtn, &QPushButton::clicked, this, &MemberList::close); } diff --git a/src/dialogs/ReadReceipts.cpp b/src/dialogs/ReadReceipts.cpp index dc4145db..03ce3068 100644 --- a/src/dialogs/ReadReceipts.cpp +++ b/src/dialogs/ReadReceipts.cpp @@ -78,13 +78,15 @@ ReceiptItem::dateFormat(const QDateTime &then) const auto days = then.daysTo(now); if (days == 0) - return QString("Today %1").arg(then.toString("HH:mm")); + return tr("Today %1").arg(then.time().toString(Qt::DefaultLocaleShortDate)); else if (days < 2) - return QString("Yesterday %1").arg(then.toString("HH:mm")); - else if (days < 365) - return then.toString("dd/MM HH:mm"); + return tr("Yesterday %1").arg(then.time().toString(Qt::DefaultLocaleShortDate)); + else if (days < 7) + return QString("%1 %2") + .arg(then.toString("dddd")) + .arg(then.time().toString(Qt::DefaultLocaleShortDate)); - return then.toString("dd/MM/yy"); + return then.toString(Qt::DefaultLocaleShortDate); } ReadReceipts::ReadReceipts(QWidget *parent) diff --git a/src/timeline/TimelineItem.cpp b/src/timeline/TimelineItem.cpp index e52dce7b..c0d7f97f 100644 --- a/src/timeline/TimelineItem.cpp +++ b/src/timeline/TimelineItem.cpp @@ -951,4 +951,4 @@ TimelineItem::openRawMessageViewer() const "failed to serialize event ({}, {})", room_id, event_id); } }); -} \ No newline at end of file +} diff --git a/src/ui/InfoMessage.cpp b/src/ui/InfoMessage.cpp index fa575d76..27bc0a5f 100644 --- a/src/ui/InfoMessage.cpp +++ b/src/ui/InfoMessage.cpp @@ -2,6 +2,7 @@ #include "Config.h" #include +#include #include #include #include @@ -61,14 +62,14 @@ DateSeparator::DateSeparator(QDateTime datetime, QWidget *parent) { auto now = QDateTime::currentDateTime(); - QString fmt; + QString fmt = QLocale::system().dateFormat(QLocale::LongFormat); - if (now.date().year() != datetime.date().year()) - fmt = QString("ddd d MMMM yy"); - else - fmt = QString("ddd d MMMM"); + if (now.date().year() == datetime.date().year()) { + QRegularExpression rx("[^a-zA-Z]*y+[^a-zA-Z]*"); + fmt = fmt.remove(rx); + } - msg_ = datetime.toString(fmt); + msg_ = datetime.date().toString(fmt); QFontMetrics fm{font()}; #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) From 0f8d882aaff74f62fe394cbe5a5486524752f0dc Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 28 Jul 2019 12:56:16 +0200 Subject: [PATCH 2/6] Fix newly added languages after timestamp localization --- resources/langs/nheko_en.ts | 26 +++++----- resources/langs/nheko_fi.ts | 101 ++++++++++++++++++++++++++++-------- 2 files changed, 93 insertions(+), 34 deletions(-) diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index 5c4bad0e..a180645d 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -441,7 +441,7 @@ Leave room - + Leave room @@ -480,7 +480,7 @@ Logout - + Logout @@ -637,12 +637,12 @@ REGISTER - + REGISTER LOGIN - + LOGIN @@ -663,17 +663,17 @@ Cancel - + Cancel Name - + Name Topic - + Topic @@ -701,7 +701,7 @@ Cancel - + Cancel @@ -719,7 +719,7 @@ Cancel - + Cancel @@ -732,7 +732,7 @@ Cancel - + Cancel @@ -745,7 +745,7 @@ Cancel - + Cancel @@ -763,7 +763,7 @@ Cancel - + Cancel @@ -778,7 +778,7 @@ Media size: %2 Cancel - + Cancel diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index e257f9d8..a81c0256 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -4,7 +4,7 @@ AudioItem - + Save File @@ -12,7 +12,7 @@ ChatPage - + Failed to upload image. Please try again. @@ -32,7 +32,7 @@ - + Failed to restore OLM account. Please login again. @@ -42,7 +42,7 @@ - + Failed to setup encryption keys. Server response: %1 %2. Please try again later. @@ -118,7 +118,7 @@ FileItem - + Save File @@ -126,7 +126,7 @@ ImageItem - + Save image @@ -205,8 +205,8 @@ - - ESC + + OK @@ -277,7 +277,7 @@ RoomInfo - + no version stored @@ -285,12 +285,12 @@ RoomInfoListItem - + Leave room - + Accept @@ -331,7 +331,7 @@ StatusIndicator - + Encrypted @@ -354,13 +354,13 @@ TextInputWidget - + Send a file - + Write a message... @@ -424,7 +424,12 @@ - + + Mentions + + + + Invite users @@ -460,7 +465,7 @@ TypingDisplay - + is typing @@ -481,7 +486,7 @@ UserSettingsPage - + Minimize to tray @@ -521,12 +526,17 @@ - + Font Family - + + Emoji Font Famly + + + + Theme @@ -566,7 +576,7 @@ - + Open Sessions File @@ -635,6 +645,14 @@ + + descriptiveTime + + + Yesterday + + + dialogs::CreateRoom @@ -776,7 +794,7 @@ Media size: %2 dialogs::ReadReceipts - + Read receipts @@ -791,6 +809,19 @@ Media size: %2 + + dialogs::ReceiptItem + + + Today %1 + + + + + Yesterday %1 + + + dialogs::RoomSettings @@ -1001,4 +1032,32 @@ Media size: %2 + + utils + + + You + + + + + sent a file. + + + + + sent an image. + + + + + sent an audio file. + + + + + sent a video + + + From 50c3d4ed3a355d1ec9209b27ae60085d56a8ce98 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 28 Jul 2019 13:16:13 +0200 Subject: [PATCH 3/6] Add decryption error messages to translations --- resources/langs/nheko_de.ts | 30 ++++++++++++++++++++++++++++++ resources/langs/nheko_el.ts | 30 ++++++++++++++++++++++++++++++ resources/langs/nheko_en.ts | 30 ++++++++++++++++++++++++++++++ resources/langs/nheko_fi.ts | 30 ++++++++++++++++++++++++++++++ resources/langs/nheko_fr.ts | 30 ++++++++++++++++++++++++++++++ resources/langs/nheko_nl.ts | 30 ++++++++++++++++++++++++++++++ resources/langs/nheko_pl.ts | 30 ++++++++++++++++++++++++++++++ resources/langs/nheko_ru.ts | 30 ++++++++++++++++++++++++++++++ resources/langs/nheko_zh_CN.ts | 30 ++++++++++++++++++++++++++++++ src/timeline/TimelineView.cpp | 28 +++++++++++++++++++++++----- 10 files changed, 293 insertions(+), 5 deletions(-) diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index 8c92c084..a3acae8e 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -415,6 +415,36 @@ Encryption is enabled + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index 74b14266..462f523e 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -415,6 +415,36 @@ Encryption is enabled + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index a180645d..afd4c815 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -415,6 +415,36 @@ Encryption is enabled + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index a81c0256..789a4ebd 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -415,6 +415,36 @@ Encryption is enabled + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index f8425e26..b8c0d6d9 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -416,6 +416,36 @@ Encryption is enabled + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index 51ec18fe..b1be0135 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -415,6 +415,36 @@ Encryption is enabled + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index ca021554..2f7c903c 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -415,6 +415,36 @@ Encryption is enabled Szyfrowanie jest włączone + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index 39cf7b72..097067db 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -415,6 +415,36 @@ Encryption is enabled Шифрование включено + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index 08463cd7..2481f989 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -415,6 +415,36 @@ Encryption is enabled 加密已启用 + + + -- Encrypted Event (No keys found for decryption) -- + Placeholder, when the message was not decrypted yet or can't be decrypted + + + + + -- Decryption Error (failed to communicate with DB) -- + Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. + + + + + -- Decryption Error (failed to retrieve megolm keys from db) -- + Placeholder, when the message can't be decrypted, because the DB access failed. + + + + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1 + + + + + -- Encrypted Event (Unknown event type) -- + Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet + + TopRoomBar diff --git a/src/timeline/TimelineView.cpp b/src/timeline/TimelineView.cpp index 18b73eb0..ed783e90 100644 --- a/src/timeline/TimelineView.cpp +++ b/src/timeline/TimelineView.cpp @@ -306,7 +306,10 @@ TimelineView::parseEncryptedEvent(const mtx::events::EncryptedEventinboundMegolmSessionExists(index)) { @@ -319,7 +322,10 @@ TimelineView::parseEncryptedEvent(const mtx::events::EncryptedEventcritical("failed to check megolm session's existence: {}", e.what()); - dummy.content.body = "-- Decryption Error (failed to communicate with DB) --"; + dummy.content.body = tr("-- Decryption Error (failed to communicate with DB) --", + "Placeholder, when the message can't be decrypted, because " + "the DB access failed when trying to lookup the session.") + .toStdString(); return {dummy, false}; } @@ -335,7 +341,10 @@ TimelineView::parseEncryptedEvent(const mtx::events::EncryptedEventcritical("failed to decrypt message with index ({}, {}, {}): {}", @@ -343,7 +352,12 @@ TimelineView::parseEncryptedEvent(const mtx::events::EncryptedEvent Date: Sun, 28 Jul 2019 16:16:02 +0200 Subject: [PATCH 4/6] media->file in error message, when image upload fails --- resources/langs/nheko_de.ts | 23 ++++------------------- resources/langs/nheko_el.ts | 23 ++++------------------- resources/langs/nheko_en.ts | 23 ++++------------------- resources/langs/nheko_fi.ts | 23 ++++------------------- resources/langs/nheko_fr.ts | 23 ++++------------------- resources/langs/nheko_nl.ts | 23 ++++------------------- resources/langs/nheko_pl.ts | 27 ++++++--------------------- resources/langs/nheko_ru.ts | 27 ++++++--------------------- resources/langs/nheko_zh_CN.ts | 27 ++++++--------------------- src/dialogs/MemberList.cpp | 2 +- src/dialogs/ReadReceipts.cpp | 2 +- src/dialogs/RoomSettings.cpp | 6 +++--- src/dialogs/UserProfile.cpp | 2 +- 13 files changed, 48 insertions(+), 183 deletions(-) diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index a3acae8e..1f856b80 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -835,16 +835,11 @@ Medien-Größe: %2 Close - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -952,12 +947,7 @@ Medien-Größe: %2 - - ESC - - - - + Failed to enable encryption: %1 @@ -973,12 +963,12 @@ Medien-Größe: %2 - The selected media is not an image + The selected file is not an image - Error while reading media: %1 + Error while reading file: %1 @@ -1015,11 +1005,6 @@ Medien-Größe: %2 Devices - - - ESC - - emoji::Panel diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index 462f523e..e50aadad 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -833,16 +833,11 @@ Media size: %2 Close - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -950,12 +945,7 @@ Media size: %2 - - ESC - - - - + Failed to enable encryption: %1 @@ -971,12 +961,12 @@ Media size: %2 - The selected media is not an image + The selected file is not an image - Error while reading media: %1 + Error while reading file: %1 @@ -1013,11 +1003,6 @@ Media size: %2 Devices - - - ESC - - emoji::Panel diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index afd4c815..e031c4ec 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -833,16 +833,11 @@ Media size: %2 Close - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -950,12 +945,7 @@ Media size: %2 - - ESC - - - - + Failed to enable encryption: %1 @@ -971,12 +961,12 @@ Media size: %2 - The selected media is not an image + The selected file is not an image - Error while reading media: %1 + Error while reading file: %1 @@ -1013,11 +1003,6 @@ Media size: %2 Devices - - - ESC - - emoji::Panel diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index 789a4ebd..2baba55d 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -833,16 +833,11 @@ Media size: %2 Close - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -950,12 +945,7 @@ Media size: %2 - - ESC - - - - + Failed to enable encryption: %1 @@ -971,12 +961,12 @@ Media size: %2 - The selected media is not an image + The selected file is not an image - Error while reading media: %1 + Error while reading file: %1 @@ -1013,11 +1003,6 @@ Media size: %2 Devices - - - ESC - - emoji::Panel diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index b8c0d6d9..355c4325 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -836,16 +836,11 @@ Taille du média : %2 Close - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -953,12 +948,7 @@ Taille du média : %2 - - ESC - - - - + Failed to enable encryption: %1 @@ -974,12 +964,12 @@ Taille du média : %2 - The selected media is not an image + The selected file is not an image - Error while reading media: %1 + Error while reading file: %1 @@ -1016,11 +1006,6 @@ Taille du média : %2 Devices - - - ESC - - emoji::Panel diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index b1be0135..db56dc0f 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -835,16 +835,11 @@ Mediagrootte: %2 Close - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -952,12 +947,7 @@ Mediagrootte: %2 - - ESC - - - - + Failed to enable encryption: %1 @@ -973,12 +963,12 @@ Mediagrootte: %2 - The selected media is not an image + The selected file is not an image - Error while reading media: %1 + Error while reading file: %1 @@ -1015,11 +1005,6 @@ Mediagrootte: %2 Devices - - - ESC - - emoji::Panel diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index 2f7c903c..34a4ed26 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -835,16 +835,11 @@ Rozmiar multimediów: %2 Close - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -955,12 +950,7 @@ Rozmiar multimediów: %2 - - ESC - - - - + Failed to enable encryption: %1 Nie udało się włączyć szyfrowania: %1 @@ -976,13 +966,13 @@ Rozmiar multimediów: %2 - The selected media is not an image - Wybrany plik multimedialny nie jest obrazem + The selected file is not an image + - Error while reading media: %1 - Błąd odczytywania pliku: %1 + Error while reading file: %1 + @@ -1018,11 +1008,6 @@ Rozmiar multimediów: %2 Devices Urządzenia - - - ESC - - emoji::Panel diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index 097067db..afe36ef9 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -836,16 +836,11 @@ Media size: %2 Close Закрыть - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -954,12 +949,7 @@ Media size: %2 - - ESC - - - - + Failed to enable encryption: %1 Не удалось включить шифрование: %1 @@ -975,13 +965,13 @@ Media size: %2 - The selected media is not an image - Выбранное медия не является изображением + The selected file is not an image + - Error while reading media: %1 - Ошибка при чтении медия: %1 + Error while reading file: %1 + @@ -1017,11 +1007,6 @@ Media size: %2 Devices Устройства - - - ESC - - emoji::Panel diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index 2481f989..607b2ba9 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -835,16 +835,11 @@ Media size: %2 Close - - - ESC - - dialogs::ReceiptItem - + Today %1 @@ -953,12 +948,7 @@ Media size: %2 - - ESC - - - - + Failed to enable encryption: %1 启用加密失败:%1 @@ -974,13 +964,13 @@ Media size: %2 - The selected media is not an image - 选择的媒体不是一个图像 + The selected file is not an image + - Error while reading media: %1 - 读取媒体时失败:%1 + Error while reading file: %1 + @@ -1016,11 +1006,6 @@ Media size: %2 Devices 设备 - - - ESC - - emoji::Panel diff --git a/src/dialogs/MemberList.cpp b/src/dialogs/MemberList.cpp index 3b957c15..88a95403 100644 --- a/src/dialogs/MemberList.cpp +++ b/src/dialogs/MemberList.cpp @@ -126,7 +126,7 @@ MemberList::MemberList(const QString &room_id, QWidget *parent) qCritical() << e.what(); } - auto closeShortcut = new QShortcut(QKeySequence("ESC"), this); + auto closeShortcut = new QShortcut(QKeySequence(QKeySequence::Cancel), this); connect(closeShortcut, &QShortcut::activated, this, &MemberList::close); connect(okBtn, &QPushButton::clicked, this, &MemberList::close); } diff --git a/src/dialogs/ReadReceipts.cpp b/src/dialogs/ReadReceipts.cpp index 03ce3068..5a0d98c7 100644 --- a/src/dialogs/ReadReceipts.cpp +++ b/src/dialogs/ReadReceipts.cpp @@ -133,7 +133,7 @@ ReadReceipts::ReadReceipts(QWidget *parent) layout->addWidget(userList_); layout->addLayout(buttonLayout); - auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this); + auto closeShortcut = new QShortcut(QKeySequence(QKeySequence::Cancel), this); connect(closeShortcut, &QShortcut::activated, this, &ReadReceipts::close); connect(okBtn, &QPushButton::clicked, this, &ReadReceipts::close); } diff --git a/src/dialogs/RoomSettings.cpp b/src/dialogs/RoomSettings.cpp index b2344f23..1fe5904b 100644 --- a/src/dialogs/RoomSettings.cpp +++ b/src/dialogs/RoomSettings.cpp @@ -438,7 +438,7 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent) resetErrorLabel(); }); - auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this); + auto closeShortcut = new QShortcut(QKeySequence(QKeySequence::Cancel), this); connect(closeShortcut, &QShortcut::activated, this, &RoomSettings::close); connect(okBtn, &QPushButton::clicked, this, &RoomSettings::close); } @@ -668,12 +668,12 @@ RoomSettings::updateAvatar() QFile file{fileName, this}; if (format != "image") { - displayErrorMessage(tr("The selected media is not an image")); + displayErrorMessage(tr("The selected file is not an image")); return; } if (!file.open(QIODevice::ReadOnly)) { - displayErrorMessage(tr("Error while reading media: %1").arg(file.errorString())); + displayErrorMessage(tr("Error while reading file: %1").arg(file.errorString())); return; } diff --git a/src/dialogs/UserProfile.cpp b/src/dialogs/UserProfile.cpp index b8040f9f..6aea96a8 100644 --- a/src/dialogs/UserProfile.cpp +++ b/src/dialogs/UserProfile.cpp @@ -183,7 +183,7 @@ UserProfile::UserProfile(QWidget *parent) qRegisterMetaType>(); - auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this); + auto closeShortcut = new QShortcut(QKeySequence(QKeySequence::Cancel), this); connect(closeShortcut, &QShortcut::activated, this, &UserProfile::close); connect(okBtn, &QPushButton::clicked, this, &UserProfile::close); } From b28115eb37e44d7c6cc3c6bf7292feea0f6a35c6 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 28 Jul 2019 16:50:04 +0200 Subject: [PATCH 5/6] Fix message_type not being initialized correctly Fixes "sent an audio file" replies, that were actually replies to text messages. --- src/timeline/TimelineItem.cpp | 12 ++++++++++++ src/timeline/TimelineItem.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/timeline/TimelineItem.cpp b/src/timeline/TimelineItem.cpp index c0d7f97f..dd3b48c3 100644 --- a/src/timeline/TimelineItem.cpp +++ b/src/timeline/TimelineItem.cpp @@ -282,6 +282,7 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty, const QString &room_id, QWidget *parent) : QWidget(parent) + , message_type_(ty) , room_id_{room_id} { init(); @@ -341,6 +342,7 @@ TimelineItem::TimelineItem(ImageItem *image, const QString &room_id, QWidget *parent) : QWidget{parent} + , message_type_(mtx::events::MessageType::Image) , room_id_{room_id} { init(); @@ -356,6 +358,7 @@ TimelineItem::TimelineItem(FileItem *file, const QString &room_id, QWidget *parent) : QWidget{parent} + , message_type_(mtx::events::MessageType::File) , room_id_{room_id} { init(); @@ -369,6 +372,7 @@ TimelineItem::TimelineItem(AudioItem *audio, const QString &room_id, QWidget *parent) : QWidget{parent} + , message_type_(mtx::events::MessageType::Audio) , room_id_{room_id} { init(); @@ -382,6 +386,7 @@ TimelineItem::TimelineItem(VideoItem *video, const QString &room_id, QWidget *parent) : QWidget{parent} + , message_type_(mtx::events::MessageType::Video) , room_id_{room_id} { init(); @@ -395,6 +400,7 @@ TimelineItem::TimelineItem(ImageItem *image, const QString &room_id, QWidget *parent) : QWidget(parent) + , message_type_(mtx::events::MessageType::Image) , room_id_{room_id} { setupWidgetLayout, ImageItem>( @@ -426,6 +432,7 @@ TimelineItem::TimelineItem(FileItem *file, const QString &room_id, QWidget *parent) : QWidget(parent) + , message_type_(mtx::events::MessageType::File) , room_id_{room_id} { setupWidgetLayout, FileItem>( @@ -440,6 +447,7 @@ TimelineItem::TimelineItem(AudioItem *audio, const QString &room_id, QWidget *parent) : QWidget(parent) + , message_type_(mtx::events::MessageType::Audio) , room_id_{room_id} { setupWidgetLayout, AudioItem>( @@ -454,6 +462,7 @@ TimelineItem::TimelineItem(VideoItem *video, const QString &room_id, QWidget *parent) : QWidget(parent) + , message_type_(mtx::events::MessageType::Video) , room_id_{room_id} { setupWidgetLayout, VideoItem>( @@ -470,6 +479,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent const QString &room_id, QWidget *parent) : QWidget(parent) + , message_type_(mtx::events::MessageType::Emote) , room_id_{room_id} { init(); @@ -565,6 +576,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent const QString &room_id, QWidget *parent) : QWidget(parent) + , message_type_(mtx::events::MessageType::Text) , room_id_{room_id} { init(); diff --git a/src/timeline/TimelineItem.h b/src/timeline/TimelineItem.h index c0dab6b8..a3294d3f 100644 --- a/src/timeline/TimelineItem.h +++ b/src/timeline/TimelineItem.h @@ -277,7 +277,7 @@ private: QFutureWatcher *colorGenerating_; QString event_id_; - mtx::events::MessageType message_type_; + mtx::events::MessageType message_type_ = mtx::events::MessageType::Unknown; QString room_id_; DescInfo descriptionMsg_; From 0398c846f6836b734bf3432696df1e04e86d8867 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 28 Jul 2019 18:13:16 +0200 Subject: [PATCH 6/6] Add 'and' to typing display --- resources/langs/nheko_de.ts | 17 ++++++++--------- resources/langs/nheko_el.ts | 17 ++++++++--------- resources/langs/nheko_en.ts | 17 ++++++++--------- resources/langs/nheko_fi.ts | 17 ++++++++--------- resources/langs/nheko_fr.ts | 17 ++++++++--------- resources/langs/nheko_nl.ts | 17 ++++++++--------- resources/langs/nheko_pl.ts | 18 +++++++++--------- resources/langs/nheko_ru.ts | 18 +++++++++--------- resources/langs/nheko_zh_CN.ts | 16 +++++++--------- src/TypingDisplay.cpp | 17 +++++++++++------ src/timeline/TimelineItem.h | 2 +- 11 files changed, 85 insertions(+), 88 deletions(-) diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index 1f856b80..80a50ae2 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -494,15 +494,14 @@ TypingDisplay - - - is typing - tippt - - - - are typing - tippen + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + %1%2 tippt + %1 und %2 tippen + diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index e50aadad..ead1ed69 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -494,15 +494,14 @@ TypingDisplay - - - is typing - πληκτρολογεί - - - - are typing - πληκτρολογούν + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + + + diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index e031c4ec..0ab8d6d8 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -494,15 +494,14 @@ TypingDisplay - - - is typing - - - - - are typing - + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + %1%2 is typing + %1 and %2 are typing + diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index 2baba55d..95403f3e 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -494,15 +494,14 @@ TypingDisplay - - - is typing - - - - - are typing - + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + + + diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index 355c4325..9c7f25c6 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -495,15 +495,14 @@ TypingDisplay - - - is typing - est en train d'écrire - - - - are typing - sont en train d'écrire + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + + + diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index db56dc0f..dbf81401 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -494,15 +494,14 @@ TypingDisplay - - - is typing - is aan het typen - - - - are typing - zijn aan het typen + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + + + diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index 34a4ed26..f4cbfd56 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -494,15 +494,15 @@ TypingDisplay - - - is typing - pisze - - - - are typing - piszą + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + + + + diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index afe36ef9..f31b23cf 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -494,15 +494,15 @@ TypingDisplay - - - is typing - печатает - - - - are typing - печатают + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + + + + diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index 607b2ba9..8da7c475 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -494,15 +494,13 @@ TypingDisplay - - - is typing - 正在打字 - - - - are typing - 正在打字 + + + %1 and %2 are typing + Multiple users are typing. First argument is a comma separated list of potentially multiple users. Second argument is the last user of that list. (If only one user is typing, %1 is empty. You should still use it in your string though to silence Qt warnings.) + + + diff --git a/src/TypingDisplay.cpp b/src/TypingDisplay.cpp index 6059601d..43fabcd8 100644 --- a/src/TypingDisplay.cpp +++ b/src/TypingDisplay.cpp @@ -33,6 +33,14 @@ TypingDisplay::setUsers(const QStringList &uid) text_.clear(); + QString temp = text_ += + tr("%1 and %2 are typing", + "Multiple users are typing. First argument is a comma separated list of potentially " + "multiple users. Second argument is the last user of that list. (If only one user is " + "typing, %1 is empty. You should still use it in your string though to silence Qt " + "warnings.)", + uid.size()); + if (uid.isEmpty()) { hide(); update(); @@ -40,12 +48,9 @@ TypingDisplay::setUsers(const QStringList &uid) return; } - text_ = uid.join(", "); - - if (uid.size() == 1) - text_ += tr(" is typing"); - else if (uid.size() > 1) - text_ += tr(" are typing"); + QStringList uidWithoutLast = uid; + uidWithoutLast.pop_back(); + text_ = temp.arg(uidWithoutLast.join(", ")).arg(uid.back()); show(); update(); diff --git a/src/timeline/TimelineItem.h b/src/timeline/TimelineItem.h index a3294d3f..fe354000 100644 --- a/src/timeline/TimelineItem.h +++ b/src/timeline/TimelineItem.h @@ -277,7 +277,7 @@ private: QFutureWatcher *colorGenerating_; QString event_id_; - mtx::events::MessageType message_type_ = mtx::events::MessageType::Unknown; + mtx::events::MessageType message_type_ = mtx::events::MessageType::Unknown; QString room_id_; DescInfo descriptionMsg_;