Address 'sent' translation issue

This commit is contained in:
Joseph Donofry 2019-07-28 18:40:23 -04:00
parent e3d69957d3
commit a9375add32
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
11 changed files with 532 additions and 31 deletions

View file

@ -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

View file

@ -962,13 +962,13 @@ Medien-Größe: %2
</message>
<message>
<location line="+12"/>
<source>The selected media is not an image</source>
<translation>Die ausgewählte Datei ist keine Bilddatei</translation>
<source>The selected file is not an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Error while reading media: %1</source>
<translation>Fehler beim lesen der Datei: %1</translation>
<source>Error while reading file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+35"/>
@ -1052,6 +1052,7 @@ Medien-Größe: %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1075,5 +1076,57 @@ Medien-Größe: %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1050,6 +1050,7 @@ Media size: %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1073,5 +1074,57 @@ Media size: %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -962,13 +962,13 @@ Media size: %2
</message>
<message>
<location line="+12"/>
<source>The selected media is not an image</source>
<translation>The selected media is not an image</translation>
<source>The selected file is not an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Error while reading media: %1</source>
<translation>Error while reading media: %1</translation>
<source>Error while reading file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+35"/>
@ -1052,6 +1052,7 @@ Media size: %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1075,5 +1076,57 @@ Media size: %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -962,13 +962,13 @@ Median koko: %2
</message>
<message>
<location line="+12"/>
<source>The selected media is not an image</source>
<translation>Valittu tiedosto ei ole kuva</translation>
<source>The selected file is not an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+5"/>
<source>Error while reading media: %1</source>
<translation>Virhe lukiessa tiedostoa: %1</translation>
<source>Error while reading file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+35"/>
@ -1052,6 +1052,7 @@ Median koko: %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1075,5 +1076,57 @@ Median koko: %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1053,6 +1053,7 @@ Taille du média : %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1076,5 +1077,57 @@ Taille du média : %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1052,6 +1052,7 @@ Mediagrootte: %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1075,5 +1076,57 @@ Mediagrootte: %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1056,6 +1056,7 @@ Rozmiar multimediów: %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1079,5 +1080,57 @@ Rozmiar multimediów: %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1055,6 +1055,7 @@ Media size: %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1078,5 +1079,57 @@ Media size: %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1060,6 +1060,7 @@ Media size: %2
<name>utils</name>
<message>
<location filename="../../src/Utils.cpp" line="+46"/>
<location filename="../../src/Utils.h" line="+141"/>
<source>You</source>
<translation type="unfinished"></translation>
</message>
@ -1083,5 +1084,57 @@ Media size: %2
<source>sent a video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Utils.h" line="-45"/>
<source>sent</source>
<comment>For when you are the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>sent</source>
<comment>For when someone else is the sender</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>%1 an audio clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 an image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a video clip</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a sticker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>%1 a notification</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+6"/>
<source>%1 an encrypted message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Unknown Message Type</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -9,6 +9,7 @@
#include "timeline/widgets/ImageItem.h"
#include "timeline/widgets/VideoItem.h"
#include <QCoreApplication>
#include <QDateTime>
#include <QPixmap>
#include <mtx/events/collections.hpp>
@ -79,7 +80,9 @@ event_body(const mtx::events::collections::TimelineEvents &event);
//! Match widgets/events with a description message.
template<class T>
QString
messageDescription(const QString &username = "", const QString &body = "")
messageDescription(const QString &username = "",
const QString &body = "",
const bool isLocal = false)
{
using Audio = mtx::events::RoomEvent<mtx::events::msg::Audio>;
using Emote = mtx::events::RoomEvent<mtx::events::msg::Emote>;
@ -91,24 +94,34 @@ messageDescription(const QString &username = "", const QString &body = "")
using Video = mtx::events::RoomEvent<mtx::events::msg::Video>;
using Encrypted = mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>;
if (std::is_same<T, AudioItem>::value || std::is_same<T, Audio>::value)
return QString("sent an audio clip");
else if (std::is_same<T, ImageItem>::value || std::is_same<T, Image>::value)
return QString("sent an image");
else if (std::is_same<T, FileItem>::value || std::is_same<T, File>::value)
return QString("sent a file");
else if (std::is_same<T, VideoItem>::value || std::is_same<T, Video>::value)
return QString("sent a video clip");
else if (std::is_same<T, StickerItem>::value || std::is_same<T, Sticker>::value)
return QString("sent a sticker");
else if (std::is_same<T, Notice>::value)
return QString("sent a notification");
else if (std::is_same<T, Text>::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<T, AudioItem>::value || std::is_same<T, Audio>::value) {
return QCoreApplication::translate("utils", "%1 an audio clip").arg(sentVerb);
} else if (std::is_same<T, ImageItem>::value || std::is_same<T, Image>::value) {
return QCoreApplication::translate("utils", "%1 an image").arg(sentVerb);
} else if (std::is_same<T, FileItem>::value || std::is_same<T, File>::value) {
return QCoreApplication::translate("utils", "%1 a file").arg(sentVerb);
} else if (std::is_same<T, VideoItem>::value || std::is_same<T, Video>::value) {
return QCoreApplication::translate("utils", "%1 a video clip").arg(sentVerb);
} else if (std::is_same<T, StickerItem>::value || std::is_same<T, Sticker>::value) {
return QCoreApplication::translate("utils", "%1 a sticker").arg(sentVerb);
} else if (std::is_same<T, Notice>::value) {
return QCoreApplication::translate("utils", "%1 a notification").arg(sentVerb);
} else if (std::is_same<T, Text>::value) {
return QString(": %1").arg(body);
else if (std::is_same<T, Emote>::value)
} else if (std::is_same<T, Emote>::value) {
return QString("* %1 %2").arg(username).arg(body);
else if (std::is_same<T, Encrypted>::value)
return QString("sent an encrypted message");
} else if (std::is_same<T, Encrypted>::value) {
return QCoreApplication::translate("utils", "%1 an encrypted message")
.arg(sentVerb);
} else {
return QCoreApplication::translate("utils", "Unknown Message Type");
}
}
template<class T, class Event>
@ -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<T>(username, QString::fromStdString(msg.content.body).trimmed())
? messageDescription<T>(
username, QString::fromStdString(msg.content.body).trimmed(), sender == localUser)
: QString(" %1").arg(messageDescription<T>()),
utils::descriptiveTime(ts),
ts};