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 "inputbar.h"
|
||||
#include "emojipanel.h"
|
||||
#include "audiorecorder.h"
|
||||
@@ -61,13 +62,13 @@ static QWidget *wrapBottomBtn(QPushButton *btn, int pad) {
|
||||
}
|
||||
|
||||
QString InputBar::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);
|
||||
}
|
||||
|
||||
InputBar::InputBar(EmojiPanel *emojiPanel, AudioRecorder *recorder, QWidget *parent)
|
||||
@@ -108,7 +109,7 @@ InputBar::InputBar(EmojiPanel *emojiPanel, AudioRecorder *recorder, QWidget *par
|
||||
layout->setSpacing(4);
|
||||
|
||||
m_attachBtn = makeIconBtn(QIcon(":/icons/attach.png"),
|
||||
QString::fromUtf8("Прикрепить"), this);
|
||||
QCoreApplication::translate("ChatGui", "Attach"), this);
|
||||
connect(m_attachBtn, &QPushButton::clicked, this, &InputBar::onAttachClicked);
|
||||
layout->addWidget(wrapBottomBtn(m_attachBtn, 3), 0, Qt::AlignBottom);
|
||||
|
||||
@@ -126,15 +127,15 @@ InputBar::InputBar(EmojiPanel *emojiPanel, AudioRecorder *recorder, QWidget *par
|
||||
layout->addWidget(m_input, 1);
|
||||
|
||||
m_emojiBtn = makeIconBtn(QIcon(":/icons/emoji.png"),
|
||||
QString::fromUtf8("Смайлики"), this);
|
||||
QCoreApplication::translate("ChatGui", "Emoji"), this);
|
||||
layout->addWidget(wrapBottomBtn(m_emojiBtn, 3), 0, Qt::AlignBottom);
|
||||
|
||||
m_pttBtn = makeIconBtn(QIcon(":/icons/mic.png"),
|
||||
QString::fromUtf8("Голосовое сообщение (удерживайте)"), this);
|
||||
QCoreApplication::translate("ChatGui", "Voice message (hold)"), this);
|
||||
layout->addWidget(wrapBottomBtn(m_pttBtn, 3), 0, Qt::AlignBottom);
|
||||
|
||||
auto *sendBtn = makeIconBtn(QIcon(":/icons/send.png"),
|
||||
QString::fromUtf8("Отправить"), this);
|
||||
QCoreApplication::translate("ChatGui", "Send"), this);
|
||||
sendBtn->setStyleSheet(sendBtn->styleSheet() +
|
||||
"QPushButton { border: 1px solid palette(highlight); }");
|
||||
layout->addWidget(sendBtn, 0, Qt::AlignBottom);
|
||||
@@ -331,7 +332,7 @@ void InputBar::onPttReleased() {
|
||||
|
||||
void InputBar::onAttachClicked() {
|
||||
if (m_channelIdForRecord.isEmpty()) return;
|
||||
QString srcPath = QFileDialog::getOpenFileName(this, QString::fromUtf8("Прикрепить файл"));
|
||||
QString srcPath = QFileDialog::getOpenFileName(this, QCoreApplication::translate("ChatGui", "Attach file"));
|
||||
if (srcPath.isEmpty()) return;
|
||||
|
||||
QFileInfo fi(srcPath);
|
||||
@@ -360,10 +361,10 @@ void InputBar::onAttachClicked() {
|
||||
bool asVideo = false;
|
||||
if (!asImage && QStringList{"mp4", "mov", "mkv", "avi", "webm", "m4v"}.contains(fi.suffix().toLower())) {
|
||||
QMessageBox box(this);
|
||||
box.setWindowTitle(QString::fromUtf8("Отправить видео"));
|
||||
box.setText(QString::fromUtf8("Файл содержит видео. Как отправить?"));
|
||||
QPushButton *fileBtn = box.addButton(QString::fromUtf8("Как файл"), QMessageBox::AcceptRole);
|
||||
QPushButton *videoBtn = box.addButton(QString::fromUtf8("Как видео"), QMessageBox::DestructiveRole);
|
||||
box.setWindowTitle(QCoreApplication::translate("ChatGui", "Send video"));
|
||||
box.setText(QCoreApplication::translate("ChatGui", "The file contains video. How would you like to send it?"));
|
||||
QPushButton *fileBtn = box.addButton(QCoreApplication::translate("ChatGui", "As a file"), QMessageBox::AcceptRole);
|
||||
QPushButton *videoBtn = box.addButton(QCoreApplication::translate("ChatGui", "As a video"), QMessageBox::DestructiveRole);
|
||||
box.exec();
|
||||
asVideo = (box.clickedButton() == videoBtn);
|
||||
if (!box.clickedButton() || (!asVideo && box.clickedButton() != fileBtn)) {
|
||||
@@ -421,8 +422,8 @@ void InputBar::updatePreparation(const QString& target, const QByteArray& job, i
|
||||
|
||||
void InputBar::showPreparation() {
|
||||
QString status;
|
||||
if (!m_preparations.value(m_channelIdForRecord).isEmpty()) status = QString::fromUtf8("Подготовка медиа…");
|
||||
else if (m_preparationErrors.contains(m_channelIdForRecord)) status = QString::fromUtf8("Не удалось подготовить вложение");
|
||||
if (!m_preparations.value(m_channelIdForRecord).isEmpty()) status = QCoreApplication::translate("ChatGui", "Preparing media…");
|
||||
else if (m_preparationErrors.contains(m_channelIdForRecord)) status = QCoreApplication::translate("ChatGui", "Failed to prepare attachment");
|
||||
m_preparationLabel->setText(status);
|
||||
m_preparationLabel->setVisible(!status.isEmpty());
|
||||
}
|
||||
@@ -442,7 +443,7 @@ void InputBar::showRecordOverlay() {
|
||||
m_recordOverlay->setGeometry(m_input->geometry().adjusted(4, 4, -4, -4));
|
||||
m_recordOverlay->show();
|
||||
m_recordOverlay->raise();
|
||||
m_recordLabel->setText(QString::fromUtf8("\xF0\x9F\x94\xB4 Recording 0:00"));
|
||||
m_recordLabel->setText(QCoreApplication::translate("ChatGui", "🔴 Recording 0:00"));
|
||||
if (m_levelBar) m_levelBar->setValue(0);
|
||||
}
|
||||
}
|
||||
@@ -454,7 +455,7 @@ void InputBar::hideRecordOverlay() {
|
||||
void InputBar::updateRecordingUI(int ms) {
|
||||
if (m_recordLabel) {
|
||||
int secs = ms / 1000;
|
||||
m_recordLabel->setText(QString::fromUtf8("\xF0\x9F\x94\xB4 Recording %1:%2")
|
||||
m_recordLabel->setText(QCoreApplication::translate("ChatGui", "🔴 Recording %1:%2")
|
||||
.arg(secs / 60).arg(secs % 60, 2, 10, QChar('0')));
|
||||
}
|
||||
if (m_levelBar && m_recorder) {
|
||||
|
||||
Reference in new issue
Block a user