From 4fd45e00285a363b2bae940ab3fd835cd5edf840 Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Mon, 5 Nov 2012 19:35:02 +0100 Subject: [PATCH] uiLanguages returns strings with "-" as separators for language/region; however QTranslator needs "_" separators --- src/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index f49a5d457..faf397d9f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,7 +120,10 @@ void LoadTranslation(const QString& prefix, const QString& path, #if QT_VERSION >= 0x040800 QString system_language = QLocale::system().uiLanguages().empty() ? - QLocale::system().name() : QLocale::system().uiLanguages()[0]; + QLocale::system().name() : QLocale::system().uiLanguages().first(); + // uiLanguages returns strings with "-" as separators for language/region; + // however QTranslator needs "_" separators + system_language.replace("-", "_"); #else QString system_language = QLocale::system().name(); #endif