diff --git a/src/modules/locale/LocaleConfiguration.cpp b/src/modules/locale/LocaleConfiguration.cpp index aa8506dec..00f13ad42 100644 --- a/src/modules/locale/LocaleConfiguration.cpp +++ b/src/modules/locale/LocaleConfiguration.cpp @@ -29,7 +29,7 @@ LocaleConfiguration::createDefault() LocaleConfiguration lc = LocaleConfiguration(); lc.lang = lc.lc_numeric = lc.lc_time = lc.lc_monetary = lc.lc_paper = lc.lc_name = lc.lc_address = lc.lc_telephone = lc.lc_measurement - = lc.lc_identification = "en_US.UTF-8 UTF-8"; + = lc.lc_identification = "en_US.UTF-8"; return lc; } @@ -51,7 +51,7 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale, QString lang; if ( linesForLanguage.length() == 0 || languageLocale.isEmpty() ) - lang = "en_US.UTF-8 UTF-8"; + lang = "en_US.UTF-8"; else if ( linesForLanguage.length() == 1 ) lang = linesForLanguage.first(); else @@ -109,7 +109,7 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale, // Else we have an unrecognized or unsupported locale, all we can do is go with // en_US.UTF-8 UTF-8. This completes all default language setting guesswork. if ( lang.isEmpty() ) - lang = "en_US.UTF-8 UTF-8"; + lang = "en_US.UTF-8"; // The following block was inspired by Ubiquity, scripts/localechooser-apply. diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index 01ab23e5d..314610eb0 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -368,7 +368,13 @@ LocalePage::init( const QString& initialRegion, ++it; } - + // We strip " UTF-8" from "en_US.UTF-8 UTF-8" because it's redundant redundant. + for ( auto it = m_localeGenLines.begin(); it != m_localeGenLines.end(); ++it ) + { + if ( it->endsWith( " UTF-8" ) ) + it->chop( 6 ); + *it = it->simplified(); + } } @@ -448,7 +454,11 @@ LocalePage::prettyLCLocale( const QString& lcLocale ) QString localeString = lcLocale; if ( localeString.endsWith( " UTF-8" ) ) localeString.remove( " UTF-8" ); - return localeString; + + QLocale locale( localeString ); + //: Language (Country) + return tr( "%1 (%2)" ).arg( QLocale::languageToString( locale.language() ) ) + .arg( QLocale::countryToString( locale.country() ) ); } void