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:
parent
82f1370111
commit
9fb426edc1
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -26,7 +26,9 @@ class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
#ifdef ENABLE_QT_TRANSLATIONS
|
||||
QTranslator translator;
|
||||
#endif
|
||||
private:
|
||||
Ui::MainWindow * ui;
|
||||
void load();
|
||||
|
Loading…
x
Reference in New Issue
Block a user