summary refs log tree commit diff
path: root/src/dialogs
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-07-28 12:50:10 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2019-07-28 12:55:08 +0200
commit1c9cc33902d8242ec25b4416a1662ee6c9902583 (patch)
tree6d7b32f32b98fdd3efc02dfc3ee43f3db4d41db7 /src/dialogs
parentTranslated using Weblate (German) (diff)
downloadnheko-1c9cc33902d8242ec25b4416a1662ee6c9902583.tar.xz
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
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/MemberList.cpp4
-rw-r--r--src/dialogs/ReadReceipts.cpp12
2 files changed, 9 insertions, 7 deletions
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)