translation of all project, and new translation mechanism

This commit is contained in:
2026-09-03 09:18:48 +03:00
parent 00e7c957e4
commit 01af372ef2
32 changed files with 2813 additions and 537 deletions
+8 -7
View File
@@ -1,4 +1,5 @@
#include "seasonalpackdownloader.h"
#include "localization.h"
#include <QDir>
#include <QFile>
@@ -50,7 +51,7 @@ void SeasonalPackDownloader::download(const QUrl &url,
const QString &label)
{
if (m_running) {
emit failed(label, tr("Загрузка сборки уже идёт"));
emit failed(label, Loc::text("seasonal.error.downloadInProgress"));
return;
}
@@ -61,18 +62,18 @@ void SeasonalPackDownloader::download(const QUrl &url,
m_label = label;
m_bytesDone = 0;
m_bytesTotal = expectedSize;
m_stage = tr("Загрузка файлов сборки");
m_stage = Loc::text("seasonal.progress.downloadingFiles");
m_currentFile = QFileInfo(targetPath).fileName();
if (!QDir().mkpath(QFileInfo(targetPath).absolutePath())) {
fail(tr("Не удалось создать %1")
fail(Loc::text("common.error.createFailed")
.arg(QDir::toNativeSeparators(QFileInfo(targetPath).absolutePath())));
return;
}
m_file = std::make_unique<QSaveFile>(targetPath);
if (!m_file->open(QIODevice::WriteOnly)) {
fail(tr("Не удалось открыть на запись %1").arg(QDir::toNativeSeparators(targetPath)));
fail(Loc::text("common.error.openForWriteFailed").arg(QDir::toNativeSeparators(targetPath)));
return;
}
m_hash.reset();
@@ -120,7 +121,7 @@ void SeasonalPackDownloader::download(const QUrl &url,
if (reply->error() != QNetworkReply::NoError) {
m_file->cancelWriting();
m_file.reset();
fail(tr("Не удалось скачать сборку: %1").arg(reply->errorString()));
fail(Loc::text("seasonal.error.downloadFailed").arg(reply->errorString()));
return;
}
@@ -128,13 +129,13 @@ void SeasonalPackDownloader::download(const QUrl &url,
if (actual.compare(m_sha256, Qt::CaseInsensitive) != 0) {
m_file->cancelWriting();
m_file.reset();
fail(tr("Контрольная сумма архива сборки не совпала — загрузка повреждена"));
fail(Loc::text("seasonal.error.checksumMismatch"));
return;
}
if (!m_file->commit()) {
m_file.reset();
fail(tr("Не удалось сохранить %1").arg(QDir::toNativeSeparators(m_targetPath)));
fail(Loc::text("common.error.saveFailed").arg(QDir::toNativeSeparators(m_targetPath)));
return;
}
m_file.reset();