Fix improper locale detection for mission map descriptions
authorWuzzy <almikes@aol.com>
Thu, 17 Nov 2016 03:35:10 +0100
changeset 11904 0b6baf802b3d
parent 11903 c885ef66bf08
child 11905 d71448338ac2
Fix improper locale detection for mission map descriptions
QTfrontend/model/MapModel.cpp
share/hedgewars/Data/Maps/Basketball/desc.txt
share/hedgewars/Data/Maps/CTF_Blizzard/desc.txt
share/hedgewars/Data/Maps/ClimbHome/CMakeLists.txt
share/hedgewars/Data/Maps/ClimbHome/desc.txt
share/hedgewars/Data/Maps/Control/desc.txt
share/hedgewars/Data/Maps/Knockball/desc.txt
share/hedgewars/Data/Maps/TrophyRace/desc.txt
--- a/QTfrontend/model/MapModel.cpp	Thu Nov 17 03:34:21 2016 +0100
+++ b/QTfrontend/model/MapModel.cpp	Thu Nov 17 03:35:10 2016 +0100
@@ -119,7 +119,12 @@
             // load description (if applicable)
             if (isMission)
             {
-                QString locale = HWApplication::keyboardInputLocale().name();
+                // get locale
+                DataManager & dataMgr = DataManager::instance();
+                QSettings settings(dataMgr.settingsFileName(), QSettings::IniFormat);
+                QString locale = settings.value("misc/locale", "").toString();
+                if (locale.isEmpty())
+                    locale = QLocale::system().name();
 
                 QSettings descSettings(QString("physfs://Maps/%1/desc.txt").arg(map), QSettings::IniFormat);
                 desc = descSettings.value(locale, QString()).toString().replace("|", "\n").replace("\\,", ",");
--- a/share/hedgewars/Data/Maps/Basketball/desc.txt	Thu Nov 17 03:34:21 2016 +0100
+++ b/share/hedgewars/Data/Maps/Basketball/desc.txt	Thu Nov 17 03:35:10 2016 +0100
@@ -1,2 +1,2 @@
-en_US=Bat your opponents through the hoops.
-de_DE=Schlag deine Gegner durch die Koerbe.
+en=Bat your opponents through the hoops.
+de=Schlag deine Gegner durch die Koerbe.
--- a/share/hedgewars/Data/Maps/CTF_Blizzard/desc.txt	Thu Nov 17 03:34:21 2016 +0100
+++ b/share/hedgewars/Data/Maps/CTF_Blizzard/desc.txt	Thu Nov 17 03:35:10 2016 +0100
@@ -1,2 +1,2 @@
-en_US=Capture the enemy flag and bring it to your own.
-de_DE=Klau die feindliche Flagge und bring sie zu deiner eigenen.
+en=Capture the enemy flag and bring it to your own.
+de=Klau die feindliche Flagge und bring sie zu deiner eigenen.
--- a/share/hedgewars/Data/Maps/ClimbHome/CMakeLists.txt	Thu Nov 17 03:34:21 2016 +0100
+++ b/share/hedgewars/Data/Maps/ClimbHome/CMakeLists.txt	Thu Nov 17 03:35:10 2016 +0100
@@ -3,4 +3,5 @@
     map.cfg
     map.lua
     preview.png
+    desc.txt
     DESTINATION ${SHAREPATH}Data/Maps/ClimbHome)
--- a/share/hedgewars/Data/Maps/ClimbHome/desc.txt	Thu Nov 17 03:34:21 2016 +0100
+++ b/share/hedgewars/Data/Maps/ClimbHome/desc.txt	Thu Nov 17 03:35:10 2016 +0100
@@ -1,2 +1,2 @@
-en_US=You are far from home and the water is rising. Climb as fast as you can.
-de_DE=Du bist fern von Zuhause und das Wasser steigt. Klettere so schnell du kannst.
+en=You are far from home and the water is rising. Climb as fast as you can.
+de=Du bist fern von Zuhause und das Wasser steigt. Klettere so schnell du kannst.
--- a/share/hedgewars/Data/Maps/Control/desc.txt	Thu Nov 17 03:34:21 2016 +0100
+++ b/share/hedgewars/Data/Maps/Control/desc.txt	Thu Nov 17 03:35:10 2016 +0100
@@ -1,2 +1,2 @@
-en_US=Stand on the pillars as long as you can.
-de_DE=Steh auf den Saeulen so lange du kannst.
+en=Stand on the pillars as long as you can.
+de=Steh auf den Saeulen so lange du kannst.
--- a/share/hedgewars/Data/Maps/Knockball/desc.txt	Thu Nov 17 03:34:21 2016 +0100
+++ b/share/hedgewars/Data/Maps/Knockball/desc.txt	Thu Nov 17 03:35:10 2016 +0100
@@ -1,2 +1,2 @@
-en_US=Knock your opponents off the platforms using only a bat!
-de_DE=Schubs deine Gegner von den Plattformen nur mit einem Baseball-Schlaeger!
+en=Knock your opponents off the platforms using only a bat!
+de=Schubs deine Gegner von den Plattformen nur mit einem Baseball-Schlaeger!
--- a/share/hedgewars/Data/Maps/TrophyRace/desc.txt	Thu Nov 17 03:34:21 2016 +0100
+++ b/share/hedgewars/Data/Maps/TrophyRace/desc.txt	Thu Nov 17 03:35:10 2016 +0100
@@ -1,2 +1,2 @@
-en_US=Use your rope to reach the finish line faster than anyone else!
-de_DE=Benutze dein Seil\, um die Ziellinie schneller als alle anderen zu erreichen!
+en=Use your rope to reach the finish line faster than anyone else!
+de=Benutze dein Seil\, um die Ziellinie schneller als alle anderen zu erreichen!