Add English and Russian ChatGUI interface translations
This commit is contained in:
1 parent
972c6b7f0a
commit
27d93ecaf9
50 files changed
+4978
-491
No files matched your search
@@ -1,3 +1,4 @@
|
||||
#include <QCoreApplication>
|
||||
#include "messagedelegate.h"
|
||||
#include "message_links.h"
|
||||
#include "chatview.h"
|
||||
@@ -334,20 +335,20 @@ static int measureTextHeight(const QFont &font, const QString &text, int width,
|
||||
}
|
||||
|
||||
static QString formatFileSize(qint64 bytes) {
|
||||
if (bytes < 1024) return QString("%1B").arg(bytes);
|
||||
if (bytes < 1024) return QCoreApplication::translate("ChatGui", "%1B").arg(bytes);
|
||||
double kb = bytes / 1024.0;
|
||||
if (kb < 1024.0) return QString("%1KB").arg(kb, 0, 'f', kb < 10.0 ? 1 : 0);
|
||||
if (kb < 1024.0) return QCoreApplication::translate("ChatGui", "%1KB").arg(kb, 0, 'f', kb < 10.0 ? 1 : 0);
|
||||
double mb = kb / 1024.0;
|
||||
if (mb < 1024.0) return QString("%1MB").arg(mb, 0, 'f', mb < 10.0 ? 1 : 0);
|
||||
if (mb < 1024.0) return QCoreApplication::translate("ChatGui", "%1MB").arg(mb, 0, 'f', mb < 10.0 ? 1 : 0);
|
||||
double gb = mb / 1024.0;
|
||||
return QString("%1GB").arg(gb, 0, 'f', 1);
|
||||
return QCoreApplication::translate("ChatGui", "%1GB").arg(gb, 0, 'f', 1);
|
||||
}
|
||||
|
||||
static QString formatBitrate(qint64 bytes, qint64 durMs) {
|
||||
if (bytes <= 0 || durMs <= 0) return QString();
|
||||
qint64 kbps = bytes * 8 / durMs;
|
||||
if (kbps >= 1000) return QString("%1Mbps").arg(kbps / 1000.0, 0, 'f', 1);
|
||||
return QString("%1kbps").arg(kbps);
|
||||
if (kbps >= 1000) return QCoreApplication::translate("ChatGui", "%1Mbps").arg(kbps / 1000.0, 0, 'f', 1);
|
||||
return QCoreApplication::translate("ChatGui", "%1kbps").arg(kbps);
|
||||
}
|
||||
|
||||
static int calcMaxLineWidth(const QFont &font, const QString &text, int availW) {
|
||||
@@ -1308,7 +1309,9 @@ void MessageDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
painter->setPen(QColor(0x80, 0x80, 0x80));
|
||||
qint64 fsz = index.data(MsgFileSizeRole).toLongLong();
|
||||
QString sizeStr = formatFileSize(fsz);
|
||||
QString stateStr = (dlState == 2) ? QString::fromUtf8("\xE2\x9C\x85") : (dlState == 1) ? "Downloading..." : "Download";
|
||||
QString stateStr = (dlState == 2) ? QString::fromUtf8("\xE2\x9C\x85") : (dlState == 1) ? QCoreApplication::translate("ChatGui",
|
||||
"Downloading...") : QCoreApplication::translate("ChatGui",
|
||||
"Download");
|
||||
QString deliveryState = index.data(MsgDeliveryStateRole).toString();
|
||||
if (!deliveryState.isEmpty()) stateStr = deliveryState;
|
||||
QString info = sizeStr + " \xC2\xB7 " + stateStr;
|
||||
@@ -1582,7 +1585,7 @@ void MessageDelegate::drawStatusBar(QPainter *p, const Layout &L,
|
||||
|
||||
QString statusText;
|
||||
if (index.data(MsgEditedRole).toBool()) {
|
||||
statusText = QString::fromUtf8("изменено ");
|
||||
statusText = QCoreApplication::translate("ChatGui", "edited ");
|
||||
}
|
||||
statusText += index.data(MsgTimeRole).toString();
|
||||
p->drawText(QRect(r.left(), r.top(), r.width(), r.height()),
|
||||
|
||||
Reference in new issue
Block a user