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
+10 -9
View File
@@ -1,4 +1,5 @@
#include "gamelauncher.h"
#include "localization.h"
#include "javalocator.h"
@@ -234,7 +235,7 @@ bool GameLauncher::extractNatives(const LaunchOptions &options,
{
if (!QDir().mkpath(nativesDir)) {
if (error)
*error = tr("Не удалось создать папку %1").arg(QDir::toNativeSeparators(nativesDir));
*error = Loc::text("launch.error.createFolderFailed").arg(QDir::toNativeSeparators(nativesDir));
return false;
}
@@ -246,7 +247,7 @@ bool GameLauncher::extractNatives(const LaunchOptions &options,
QZipReader reader(jar);
if (!reader.isReadable()) {
if (error)
*error = tr("Не удалось прочитать натив-библиотеку %1")
*error = Loc::text("launch.error.nativeReadFailed")
.arg(QDir::toNativeSeparators(jar));
return false;
}
@@ -282,7 +283,7 @@ bool GameLauncher::extractNatives(const LaunchOptions &options,
QFile file(target);
if (!file.open(QIODevice::WriteOnly) || file.write(data) != data.size()) {
if (error)
*error = tr("Не удалось распаковать %1 в %2")
*error = Loc::text("launch.error.extractFailed")
.arg(fileName, QDir::toNativeSeparators(nativesDir));
return false;
}
@@ -298,27 +299,27 @@ bool GameLauncher::launch(const LaunchOptions &options,
{
if (isRunning()) {
if (error)
*error = tr("Игра уже запущена");
*error = Loc::text("common.error.gameRunning");
return false;
}
emit progress(tr("Проверка файлов игры…"));
emit progress(Loc::text("launch.progress.checkingFiles"));
const QStringList missing = missingFiles(options, version);
if (!missing.isEmpty()) {
if (error)
*error = tr("В .minecraft не хватает файлов (%1):\n%2")
*error = Loc::text("launch.error.filesMissing")
.arg(missing.size())
.arg(missing.join(u'\n'));
return false;
}
emit progress(tr("Распаковка нативных библиотек…"));
emit progress(Loc::text("launch.progress.extractingNatives"));
const QString nativesDir = options.gameDir + QStringLiteral("/versions/") + version.id
+ QStringLiteral("/natives");
if (!extractNatives(options, version, nativesDir, error))
return false;
emit progress(tr("Поиск Java %1…").arg(version.javaMajor));
emit progress(Loc::text("launch.progress.lookingForJava").arg(version.javaMajor));
const QString java = JavaLocator::select(options.gameDir, version.javaMajor, options.javaPath, error);
if (java.isEmpty())
return false;
@@ -352,7 +353,7 @@ bool GameLauncher::launch(const LaunchOptions &options,
m_process->start();
if (!m_process->waitForStarted(15000)) {
if (error)
*error = tr("Не удалось запустить %1: %2")
*error = Loc::text("launch.error.startFailed")
.arg(QDir::toNativeSeparators(executable), m_process->errorString());
m_process->deleteLater();
m_process = nullptr;