From 607007f94f32a29e6d7340acffabf74fd7ee9540 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sat, 18 Jul 2015 18:38:41 +0200 Subject: [PATCH] Display country in language list. But only if the translation specifies one. --- src/core/Translator.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/Translator.cpp b/src/core/Translator.cpp index bc4d2b629..ed63693cb 100644 --- a/src/core/Translator.cpp +++ b/src/core/Translator.cpp @@ -67,8 +67,15 @@ QList > Translator::availableLanguages() langcode = "en"; } - languages.append(QPair(langcode, - QLocale::languageToString(QLocale(langcode).language()))); + QLocale locale(langcode); + QString languageStr = QLocale::languageToString(locale.language()); + QString countryStr; + if (langcode.contains("_")) { + countryStr = QString(" (%1)").arg(QLocale::countryToString(locale.country())); + } + + QPair language(langcode, languageStr + countryStr); + languages.append(language); } } }