fix 'failed to install translation' message when misc/locale in hedgewars.ini is empty (which is *always* when 'system default' is selected)
authorkoda
Sat, 06 Apr 2013 02:11:02 +0200
changeset 8882 73d6d7f27945
parent 8880 71ed64b18540
child 8884 08fe08651130
fix 'failed to install translation' message when misc/locale in hedgewars.ini is empty (which is *always* when 'system default' is selected)
QTfrontend/main.cpp
--- a/QTfrontend/main.cpp	Sat Apr 06 01:19:47 2013 +0200
+++ b/QTfrontend/main.cpp	Sat Apr 06 02:11:02 2013 +0200
@@ -267,12 +267,13 @@
     {
         QSettings settings("physfs://hedgewars.ini", QSettings::IniFormat);
         QString cc = settings.value("misc/locale", QString()).toString();
-        if(cc.isEmpty())
-            cc = QLocale::system().name();
+        if (cc.isEmpty())
+            cc = HWApplication::keyboardInputLocale().name();
+            // QLocale::system().name() returns only "C"...
 
         // load locale file into translator
-        if(!Translator.load(QString("physfs://Locale/hedgewars_%1").arg(cc)))
-            qWarning("Failed to install translation");
+        if (!Translator.load(QString("physfs://Locale/hedgewars_%1").arg(cc)))
+            qWarning("Failed to install translation (%s)", qPrintable(cc));
         app.installTranslator(&Translator);
     }