From a9375add32ae6c5cd90679cf6cb7e2af18c27e7a Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Sun, 28 Jul 2019 18:40:23 -0400 Subject: [PATCH] Address 'sent' translation issue --- CHANGELOG.md | 9 +++++ resources/langs/nheko_de.ts | 61 +++++++++++++++++++++++++++++++--- resources/langs/nheko_el.ts | 53 +++++++++++++++++++++++++++++ resources/langs/nheko_en.ts | 61 +++++++++++++++++++++++++++++++--- resources/langs/nheko_fi.ts | 61 +++++++++++++++++++++++++++++++--- resources/langs/nheko_fr.ts | 53 +++++++++++++++++++++++++++++ resources/langs/nheko_nl.ts | 53 +++++++++++++++++++++++++++++ resources/langs/nheko_pl.ts | 53 +++++++++++++++++++++++++++++ resources/langs/nheko_ru.ts | 53 +++++++++++++++++++++++++++++ resources/langs/nheko_zh_CN.ts | 53 +++++++++++++++++++++++++++++ src/Utils.h | 53 ++++++++++++++++++----------- 11 files changed, 532 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9df96e65..55e59332 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,22 @@ ### [0.7.0] -- Unreleased +0.7.0 *requires* mtxclient 0.3.0. Make sure you compile against 0.3.0 +if you do not use the mtxclient bundled with nheko. + #### Features - Make nheko session import / export format match riot. Fixes #48 (WIP) - Implement proper replies (WIP) +- Add .well-known support for auto-completing homeserver information +- Add mentions viewer so you can see all the messages you have been mentioned in (WIP) +- Add emoji font selection preference #### Improvements - Add dedicated reply button to Timeline items. Add button for other options so that right click isn't always required. +- Fix various things with regards to emoji rendering and the emoji picker (WIP) +- Lots and lots and lots of localization updates. +- Additional tweaks to the system theme ## [0.6.4] - 2019-05-22 diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index 84c712ba..2099d059 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -962,13 +962,13 @@ Medien-Größe: %2 - The selected media is not an image - Die ausgewählte Datei ist keine Bilddatei + The selected file is not an image + - Error while reading media: %1 - Fehler beim lesen der Datei: %1 + Error while reading file: %1 + @@ -1052,6 +1052,7 @@ Medien-Größe: %2 utils + You @@ -1075,5 +1076,57 @@ Medien-Größe: %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index ead1ed69..c8805905 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -1050,6 +1050,7 @@ Media size: %2 utils + You @@ -1073,5 +1074,57 @@ Media size: %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index 298abfc7..5dcb4f61 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -962,13 +962,13 @@ Media size: %2 - The selected media is not an image - The selected media is not an image + The selected file is not an image + - Error while reading media: %1 - Error while reading media: %1 + Error while reading file: %1 + @@ -1052,6 +1052,7 @@ Media size: %2 utils + You @@ -1075,5 +1076,57 @@ Media size: %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index 718f1084..86374eb4 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -962,13 +962,13 @@ Median koko: %2 - The selected media is not an image - Valittu tiedosto ei ole kuva + The selected file is not an image + - Error while reading media: %1 - Virhe lukiessa tiedostoa: %1 + Error while reading file: %1 + @@ -1052,6 +1052,7 @@ Median koko: %2 utils + You @@ -1075,5 +1076,57 @@ Median koko: %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index 9c7f25c6..100b78aa 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -1053,6 +1053,7 @@ Taille du média : %2 utils + You @@ -1076,5 +1077,57 @@ Taille du média : %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index dbf81401..59642683 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -1052,6 +1052,7 @@ Mediagrootte: %2 utils + You @@ -1075,5 +1076,57 @@ Mediagrootte: %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index f4cbfd56..74d08608 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -1056,6 +1056,7 @@ Rozmiar multimediów: %2 utils + You @@ -1079,5 +1080,57 @@ Rozmiar multimediów: %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index f31b23cf..b2b18ee3 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -1055,6 +1055,7 @@ Media size: %2 utils + You @@ -1078,5 +1079,57 @@ Media size: %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index 8da7c475..772b32d2 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -1060,6 +1060,7 @@ Media size: %2 utils + You @@ -1083,5 +1084,57 @@ Media size: %2 sent a video + + + sent + For when you are the sender + + + + + sent + For when someone else is the sender + + + + + %1 an audio clip + + + + + %1 an image + + + + + %1 a file + + + + + %1 a video clip + + + + + %1 a sticker + + + + + %1 a notification + + + + + %1 an encrypted message + + + + + Unknown Message Type + + diff --git a/src/Utils.h b/src/Utils.h index 756dc1e3..d2aa6d93 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -9,6 +9,7 @@ #include "timeline/widgets/ImageItem.h" #include "timeline/widgets/VideoItem.h" +#include #include #include #include @@ -79,7 +80,9 @@ event_body(const mtx::events::collections::TimelineEvents &event); //! Match widgets/events with a description message. template QString -messageDescription(const QString &username = "", const QString &body = "") +messageDescription(const QString &username = "", + const QString &body = "", + const bool isLocal = false) { using Audio = mtx::events::RoomEvent; using Emote = mtx::events::RoomEvent; @@ -91,24 +94,34 @@ messageDescription(const QString &username = "", const QString &body = "") using Video = mtx::events::RoomEvent; using Encrypted = mtx::events::EncryptedEvent; - if (std::is_same::value || std::is_same::value) - return QString("sent an audio clip"); - else if (std::is_same::value || std::is_same::value) - return QString("sent an image"); - else if (std::is_same::value || std::is_same::value) - return QString("sent a file"); - else if (std::is_same::value || std::is_same::value) - return QString("sent a video clip"); - else if (std::is_same::value || std::is_same::value) - return QString("sent a sticker"); - else if (std::is_same::value) - return QString("sent a notification"); - else if (std::is_same::value) + // Sometimes the verb form of sent changes in some languages depending on the actor. + auto remoteSent = + QCoreApplication::translate("utils", "sent", "For when you are the sender"); + auto localSent = + QCoreApplication::translate("utils", "sent", "For when someone else is the sender"); + QString sentVerb = isLocal ? localSent : remoteSent; + if (std::is_same::value || std::is_same::value) { + return QCoreApplication::translate("utils", "%1 an audio clip").arg(sentVerb); + } else if (std::is_same::value || std::is_same::value) { + return QCoreApplication::translate("utils", "%1 an image").arg(sentVerb); + } else if (std::is_same::value || std::is_same::value) { + return QCoreApplication::translate("utils", "%1 a file").arg(sentVerb); + } else if (std::is_same::value || std::is_same::value) { + return QCoreApplication::translate("utils", "%1 a video clip").arg(sentVerb); + } else if (std::is_same::value || std::is_same::value) { + return QCoreApplication::translate("utils", "%1 a sticker").arg(sentVerb); + } else if (std::is_same::value) { + return QCoreApplication::translate("utils", "%1 a notification").arg(sentVerb); + } else if (std::is_same::value) { return QString(": %1").arg(body); - else if (std::is_same::value) + } else if (std::is_same::value) { return QString("* %1 %2").arg(username).arg(body); - else if (std::is_same::value) - return QString("sent an encrypted message"); + } else if (std::is_same::value) { + return QCoreApplication::translate("utils", "%1 an encrypted message") + .arg(sentVerb); + } else { + return QCoreApplication::translate("utils", "Unknown Message Type"); + } } template @@ -129,10 +142,12 @@ createDescriptionInfo(const Event &event, const QString &localUser, const QStrin return DescInfo{ QString::fromStdString(msg.event_id), - isEmote ? "" : (sender == localUser ? "You" : username), + isEmote ? "" + : (sender == localUser ? QCoreApplication::translate("utils", "You") : username), sender, (isText || isEmote) - ? messageDescription(username, QString::fromStdString(msg.content.body).trimmed()) + ? messageDescription( + username, QString::fromStdString(msg.content.body).trimmed(), sender == localUser) : QString(" %1").arg(messageDescription()), utils::descriptiveTime(ts), ts};