1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Do not use translator without translator tools

This commit is contained in:
Ivan Savenko 2022-12-25 23:42:06 +02:00
parent 82f1370111
commit 9fb426edc1
3 changed files with 7 additions and 0 deletions

View File

@ -337,6 +337,9 @@ if(ENABLE_LAUNCHER OR ENABLE_EDITOR)
if (NOT Qt5LinguistTools_DIR)
set(ENABLE_TRANSLATIONS OFF)
endif()
if (ENABLE_TRANSLATIONS)
add_definitions(-DENABLE_QT_TRANSLATIONS)
endif()
endif()
if(ENABLE_NULLKILLER_AI)

View File

@ -137,6 +137,7 @@ void MainWindow::on_lobbyButton_clicked()
void MainWindow::updateTranslation()
{
#ifdef ENABLE_QT_TRANSLATIONS
std::string languageCode = settings["general"]["language"].String();
QString translationFile = "./launcher/translations/" + QString::fromStdString(languageCode) + ".qm";
@ -146,4 +147,5 @@ void MainWindow::updateTranslation()
logGlobal->error("Failed to load translation");
if (!qApp->installTranslator(&translator))
logGlobal->error("Failed to install translator");
#endif
}

View File

@ -26,7 +26,9 @@ class MainWindow : public QMainWindow
{
Q_OBJECT
#ifdef ENABLE_QT_TRANSLATIONS
QTranslator translator;
#endif
private:
Ui::MainWindow * ui;
void load();