mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 18:05:36 -04:00
[libcalamaresui] Drop now-unused sortKey from LocaleLabel
- sortKey is unused - add englishLabel for reverse-i18n
This commit is contained in:
parent
5e951466df
commit
620940c75b
2 changed files with 10 additions and 10 deletions
|
@ -269,26 +269,20 @@ LocaleLabel::LocaleLabel( const QString& locale, LabelFormat format )
|
||||||
//: language[name] (country[name])
|
//: language[name] (country[name])
|
||||||
QString longFormat = QObject::tr( "%1 (%2)" );
|
QString longFormat = QObject::tr( "%1 (%2)" );
|
||||||
|
|
||||||
QString sortKey = QLocale::languageToString( m_locale.language() );
|
|
||||||
QString languageName = m_locale.nativeLanguageName();
|
QString languageName = m_locale.nativeLanguageName();
|
||||||
|
QString englishName = m_locale.languageToString( m_locale.language() );
|
||||||
QString countryName;
|
QString countryName;
|
||||||
|
|
||||||
if ( languageName.isEmpty() )
|
if ( languageName.isEmpty() )
|
||||||
languageName = QString( QLatin1Literal( "* %1 (%2)" ) ).arg( locale, sortKey );
|
languageName = QString( QLatin1Literal( "* %1 (%2)" ) ).arg( locale, englishName );
|
||||||
|
|
||||||
bool needsCountryName = ( format == LabelFormat::AlwaysWithCountry ) ||
|
bool needsCountryName = ( format == LabelFormat::AlwaysWithCountry ) ||
|
||||||
(locale.contains( '_' ) && QLocale::countriesForLanguage( m_locale.language() ).count() > 1 );
|
(locale.contains( '_' ) && QLocale::countriesForLanguage( m_locale.language() ).count() > 1 );
|
||||||
|
|
||||||
if ( needsCountryName )
|
if ( needsCountryName )
|
||||||
{
|
|
||||||
sortKey.append( '+' );
|
|
||||||
sortKey.append( QLocale::countryToString( m_locale.country() ) );
|
|
||||||
|
|
||||||
countryName = m_locale.nativeCountryName();
|
countryName = m_locale.nativeCountryName();
|
||||||
}
|
|
||||||
|
|
||||||
m_sortKey = sortKey;
|
|
||||||
m_label = needsCountryName ? longFormat.arg( languageName ).arg( countryName ) : languageName;
|
m_label = needsCountryName ? longFormat.arg( languageName ).arg( countryName ) : languageName;
|
||||||
|
m_englishLabel = englishName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLocale LocaleLabel::getLocale( const QString& localeName )
|
QLocale LocaleLabel::getLocale( const QString& localeName )
|
||||||
|
|
|
@ -172,6 +172,12 @@ public:
|
||||||
{
|
{
|
||||||
return m_label;
|
return m_label;
|
||||||
}
|
}
|
||||||
|
/** @brief Get the *English* human-readable name for this locale. */
|
||||||
|
QString englishLabel() const
|
||||||
|
{
|
||||||
|
return m_englishLabel;
|
||||||
|
}
|
||||||
|
|
||||||
/** @brief Get the Qt locale. */
|
/** @brief Get the Qt locale. */
|
||||||
QLocale locale() const
|
QLocale locale() const
|
||||||
{
|
{
|
||||||
|
@ -188,8 +194,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
QLocale m_locale;
|
QLocale m_locale;
|
||||||
QString m_localeId; // the locale identifier, e.g. "en_GB"
|
QString m_localeId; // the locale identifier, e.g. "en_GB"
|
||||||
QString m_sortKey; // the English name of the locale
|
|
||||||
QString m_label; // the native name of the locale
|
QString m_label; // the native name of the locale
|
||||||
|
QString m_englishLabel;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue