uiLanguages returns strings with "-" as separators for language/region; however QTranslator needs "_" separators

This commit is contained in:
Arnaud Bienner 2012-11-05 19:35:02 +01:00
parent 3ff5608ca7
commit 4fd45e0028
1 changed files with 4 additions and 1 deletions

View File

@ -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