merge Wuzzy's qttranslation bookmark
authorsheepluva
Sun, 10 Jan 2016 19:45:43 +0100
changeset 11494 84eb32d9e279
parent 11492 8e221d2a368e (current diff)
parent 11493 637fb0558a73 (diff)
child 11496 1010f5cc4881
merge Wuzzy's qttranslation bookmark
--- a/QTfrontend/main.cpp	Sun Jan 10 18:01:17 2016 +0100
+++ b/QTfrontend/main.cpp	Sun Jan 10 19:45:43 2016 +0100
@@ -28,6 +28,7 @@
 #include <QDate>
 #include <QDesktopWidget>
 #include <QLabel>
+#include <QLibraryInfo>
 
 #include "hwform.h"
 #include "hwconsts.h"
@@ -318,7 +319,8 @@
     engine->setWriteDir(cfgdir->absolutePath());
     engine->mountPacks();
 
-    QTranslator Translator;
+    QTranslator TranslatorHedgewars;
+    QTranslator TranslatorQt;
     {
         QSettings settings(DataManager::instance().settingsFileName(), QSettings::IniFormat);
         settings.setIniCodec("UTF-8");
@@ -333,10 +335,13 @@
                 cc = HWApplication::keyboardInputLocale().name();
         }
 
-        // load locale file into translator
-        if (!Translator.load(QString("physfs://Locale/hedgewars_%1").arg(cc)))
-            qWarning("Failed to install translation (%s)", qPrintable(cc));
-        app.installTranslator(&Translator);
+        // Load locale files into translators
+        if (!TranslatorHedgewars.load(QString("physfs://Locale/hedgewars_%1").arg(cc)))
+            qWarning("Failed to install Hedgewars translation (%s)", qPrintable(cc));
+        if (!TranslatorQt.load(QString("%1/qt_%2").arg(QLibraryInfo::location(QLibraryInfo::TranslationsPath), cc)))
+            qWarning("Failed to install Qt translation (%s)", qPrintable(cc));
+        app.installTranslator(&TranslatorHedgewars);
+        app.installTranslator(&TranslatorQt);
         app.setLayoutDirection(QLocale(cc).textDirection());
     }