Skip to content
Snippets Groups Projects
Commit e6cabe27 authored by Teo Mrnjavac's avatar Teo Mrnjavac
Browse files

Fix locale names and user-visible locale names.

parent 2b26f6e6
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ LocaleConfiguration::createDefault() ...@@ -29,7 +29,7 @@ LocaleConfiguration::createDefault()
LocaleConfiguration lc = LocaleConfiguration(); LocaleConfiguration lc = LocaleConfiguration();
lc.lang = lc.lc_numeric = lc.lc_time = lc.lc_monetary = lc.lc_paper = lc.lc_name 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_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; return lc;
} }
...@@ -51,7 +51,7 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale, ...@@ -51,7 +51,7 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale,
QString lang; QString lang;
if ( linesForLanguage.length() == 0 || languageLocale.isEmpty() ) if ( linesForLanguage.length() == 0 || languageLocale.isEmpty() )
lang = "en_US.UTF-8 UTF-8"; lang = "en_US.UTF-8";
else if ( linesForLanguage.length() == 1 ) else if ( linesForLanguage.length() == 1 )
lang = linesForLanguage.first(); lang = linesForLanguage.first();
else else
...@@ -109,7 +109,7 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale, ...@@ -109,7 +109,7 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale,
// Else we have an unrecognized or unsupported locale, all we can do is go with // 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. // en_US.UTF-8 UTF-8. This completes all default language setting guesswork.
if ( lang.isEmpty() ) 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. // The following block was inspired by Ubiquity, scripts/localechooser-apply.
......
...@@ -368,7 +368,13 @@ LocalePage::init( const QString& initialRegion, ...@@ -368,7 +368,13 @@ LocalePage::init( const QString& initialRegion,
++it; ++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 ) ...@@ -448,7 +454,11 @@ LocalePage::prettyLCLocale( const QString& lcLocale )
QString localeString = lcLocale; QString localeString = lcLocale;
if ( localeString.endsWith( " UTF-8" ) ) if ( localeString.endsWith( " UTF-8" ) )
localeString.remove( " 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 void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment