Add English and Russian ChatGUI interface translations

This commit is contained in:
evgeny committed 2026-10-05 16:55:43 +02:00
1 parent 972c6b7f0a
commit 27d93ecaf9
50 files changed
+4978 -491

No files matched your search

+15 -14
View File
@@ -1,3 +1,4 @@
#include <QCoreApplication>
#include "invite_link.h"
#include "debug_ui.h"
#include <QByteArray>
@@ -61,13 +62,13 @@ QString encodeInviteLink(uint64_t channelId, const QByteArray& pubkey,
InviteData decodeInviteLink(const QString& link) {
InviteData d;
if (!link.startsWith(QLatin1String("utun://"))) {
d.error = QStringLiteral("invalid prefix (expected utun://)");
d.error = QCoreApplication::translate("ChatGui", "invalid prefix (expected utun://)");
GUI_ERROR("decodeInviteLink: invalid prefix");
return d;
}
QByteArray blob = QByteArray::fromBase64(link.mid(7).toLatin1());
if (blob.isEmpty()) {
d.error = QStringLiteral("base64 decode failed");
d.error = QCoreApplication::translate("ChatGui", "base64 decode failed");
GUI_ERROR("decodeInviteLink: base64 decode failed");
return d;
}
@@ -75,7 +76,7 @@ InviteData decodeInviteLink(const QString& link) {
int len = blob.size();
if (len < 11) {
d.error = QStringLiteral("blob too short (%1 bytes)").arg(len);
d.error = QCoreApplication::translate("ChatGui", "blob too short (%1 bytes)").arg(len);
GUI_ERROR("decodeInviteLink: blob too short (%d bytes)", len);
return d;
}
@@ -83,7 +84,7 @@ InviteData decodeInviteLink(const QString& link) {
uint8_t ver = data[off++];
if (ver != INVITE_LINK_VERSION && ver != 0x02 && ver != 0x01) {
d.error = QStringLiteral("unsupported version 0x%1").arg(ver, 2, 16, QLatin1Char('0'));
d.error = QCoreApplication::translate("ChatGui", "unsupported version 0x%1").arg(ver, 2, 16, QLatin1Char('0'));
GUI_ERROR("decodeInviteLink: unsupported version %d", ver);
return d;
}
@@ -91,13 +92,13 @@ InviteData decodeInviteLink(const QString& link) {
/* v2/v3: password field before channel_id */
if (ver == 0x02 || ver == INVITE_LINK_VERSION) {
if (off >= len) {
d.error = QStringLiteral("truncated at pass_len");
d.error = QCoreApplication::translate("ChatGui", "truncated at pass_len");
return d;
}
uint8_t plen = data[off++];
if (plen > 0) {
if (off + plen > len) {
d.error = QStringLiteral("truncated at password");
d.error = QCoreApplication::translate("ChatGui", "truncated at password");
return d;
}
d.password = QString::fromUtf8(reinterpret_cast<const char*>(data + off), plen);
@@ -107,7 +108,7 @@ InviteData decodeInviteLink(const QString& link) {
/* channel_id: uint64 big-endian */
if (off + 8 > len) {
d.error = QStringLiteral("truncated at channel_id");
d.error = QCoreApplication::translate("ChatGui", "truncated at channel_id");
GUI_ERROR("decodeInviteLink: truncated at channel_id");
return d;
}
@@ -118,7 +119,7 @@ InviteData decodeInviteLink(const QString& link) {
/* join_key: uint64 big-endian */
if (off + 8 > len) {
d.error = QStringLiteral("truncated at join_key");
d.error = QCoreApplication::translate("ChatGui", "truncated at join_key");
GUI_ERROR("decodeInviteLink: truncated at join_key");
return d;
}
@@ -129,15 +130,15 @@ InviteData decodeInviteLink(const QString& link) {
/* v3: reality-блок (node-global параметры) */
if (ver == INVITE_LINK_VERSION) {
if (off >= len) { d.error = QStringLiteral("truncated at reality"); return d; }
if (off >= len) { d.error = QCoreApplication::translate("ChatGui", "truncated at reality"); return d; }
if (data[off++] != 0) {
if (off + 8 + 32 + 3 + 1 > len) { d.error = QStringLiteral("truncated at reality params"); return d; }
if (off + 8 + 32 + 3 + 1 > len) { d.error = QCoreApplication::translate("ChatGui", "truncated at reality params"); return d; }
d.reality.shortId = QByteArray(reinterpret_cast<const char*>(data + off), 8); off += 8;
d.reality.serverPubkey = QByteArray(reinterpret_cast<const char*>(data + off), 32); off += 32;
d.reality.version = QByteArray(reinterpret_cast<const char*>(data + off), 3); off += 3;
uint8_t snlen = data[off++];
if (snlen > INVITE_SNAME_MAX - 1) snlen = INVITE_SNAME_MAX - 1;
if (off + snlen > len) { d.error = QStringLiteral("truncated at reality server_name"); return d; }
if (off + snlen > len) { d.error = QCoreApplication::translate("ChatGui", "truncated at reality server_name"); return d; }
d.reality.serverName = QString::fromUtf8(reinterpret_cast<const char*>(data + off), snlen);
off += snlen;
d.reality.has = true;
@@ -149,12 +150,12 @@ InviteData decodeInviteLink(const QString& link) {
uint8_t header = data[off++];
int cnt = (header & 0x03) + 1;
if (cnt < 1 || cnt > 4) {
d.error = QStringLiteral("invalid addr count %1").arg(cnt);
d.error = QCoreApplication::translate("ChatGui", "invalid addr count %1").arg(cnt);
GUI_ERROR("decodeInviteLink: invalid addr count %d", cnt);
return d;
}
if (off + 32 > len) {
d.error = QStringLiteral("truncated at pubkey");
d.error = QCoreApplication::translate("ChatGui", "truncated at pubkey");
GUI_ERROR("decodeInviteLink: truncated at pubkey");
return d;
}
@@ -168,7 +169,7 @@ InviteData decodeInviteLink(const QString& link) {
bool isV6 = header & (1 << (2 + j));
int ipLen = isV6 ? 16 : 4;
if (off + 2 + ipLen + 2 > len) {
d.error = QStringLiteral("truncated at addr %1 of block").arg(j);
d.error = QCoreApplication::translate("ChatGui", "truncated at addr %1 of block").arg(j);
GUI_ERROR("decodeInviteLink: truncated at addr %d of block", j);
return d;
}