mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 02:15:36 -04:00
[locale] prefer native language and country names when available
This basically means we talk about localization in the respective localized variant. e.g. "German (Germany)" ➡ "Deutsch (Deutschland)". If geoip lookup failed or isn't configured for whatever reason it's a stretch to expect the user to know english enough to find their own language. Preferring the localized strings resolves this issue. Additionally this happens to bypass #712 respectively https://bugreports.qt.io/browse/QTBUG-34287 as the native names are properly spelled. So, as long as Qt has localized names the names will also be properly spelled.
This commit is contained in:
parent
0b6e1ca488
commit
311af6de5d
3 changed files with 9 additions and 3 deletions
|
@ -369,6 +369,8 @@ KeyboardPage::onActivate()
|
||||||
{
|
{
|
||||||
const auto langParts = lang.split( '_', QString::SkipEmptyParts );
|
const auto langParts = lang.split( '_', QString::SkipEmptyParts );
|
||||||
|
|
||||||
|
// Note that this his string is not fit for display purposes!
|
||||||
|
// It doesn't come from QLocale::nativeCountryName.
|
||||||
QString country = QLocale::countryToString( QLocale( lang ).country() );
|
QString country = QLocale::countryToString( QLocale( lang ).country() );
|
||||||
cDebug() << " .. extracted country" << country << "::" << langParts;
|
cDebug() << " .. extracted country" << country << "::" << langParts;
|
||||||
|
|
||||||
|
|
|
@ -477,8 +477,13 @@ LocalePage::prettyLCLocale( const QString& lcLocale ) const
|
||||||
|
|
||||||
QLocale locale( localeString );
|
QLocale locale( localeString );
|
||||||
//: Language (Country)
|
//: Language (Country)
|
||||||
return tr( "%1 (%2)" ).arg( QLocale::languageToString( locale.language() ) )
|
const QString lang = !locale.nativeLanguageName().isEmpty() ?
|
||||||
.arg( QLocale::countryToString( locale.country() ) );
|
locale.nativeLanguageName() :
|
||||||
|
QLocale::languageToString( locale.language() );
|
||||||
|
const QString country = !locale.nativeCountryName().isEmpty() ?
|
||||||
|
locale.nativeCountryName() :
|
||||||
|
QLocale::countryToString( locale.country() );
|
||||||
|
return tr( "%1 (%2)" ).arg( lang ).arg( country );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -345,4 +345,3 @@ WelcomePage::focusInEvent( QFocusEvent* e )
|
||||||
ui->languageWidget->setFocus();
|
ui->languageWidget->setFocus();
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue