i18n: repair language names for Chinese

Prompted by Linlinger, I've reconsidered the names of languages
in the drop-down in the welcome page. We already have the
infrastructure for assigning specific names / locales to
"Calamares locale names" (which match Transifex names, not
necessarily Qt names). Use that to put exactly two Chinese-
language translations in the drop-down:
- Simplified Chinese (code zh_CN)
- Traditional Chinese (code zh_TW)
Drop zh (which is a peculiar locale name anyway) and zh_HK
(which is Traditional Chinese, but using the geographic
boundary is a bit weird; we're going to ignore the
minor orthographic differences with Traditional Chinese
written elsewhere for now).

Note that this makes the drop-down show "Chinese"
in the English column, twice; the difference is visible
only in the native-language representation.

SEE #1741
This commit is contained in:
Adriaan de Groot 2021-09-07 15:47:30 +02:00
parent e11b42ce50
commit 24162cb162
2 changed files with 17 additions and 7 deletions

View File

@ -138,9 +138,9 @@ set( _tx_complete az az_AZ ca de fi_FI he hi hr ja ko lt pt_BR sq
set( _tx_good as be ca@valencia cs_CZ da fr fur it_IT ml nl pt_PT
ru sk tg tr_TR vi zh_CN )
set( _tx_ok ar ast bg bn el en_GB es es_MX es_PR et eu fa gl hu id
is mr nb pl ro si sl sr sr@latin th zh_HK )
is mr nb pl ro si sl sr sr@latin th )
set( _tx_incomplete eo es_PE fr_CH gu id_ID ie kk kn ko_KR lo lv mk
ne ne_NP ru_RU te ur uz zh )
ne ne_NP ru_RU te ur uz )
### Required versions
#

View File

@ -38,6 +38,18 @@ specialCase( const CalamaresUtils::Locale::Translation::Id& locale )
static QString name = QStringLiteral( "Català (València)" );
return { nullptr, &name };
}
if ( localeName == "zh_CN" )
{
// Simplified Chinese, but drop the (China) from the name
static QString name = QStringLiteral( "简体中文" );
return { nullptr, &name };
}
if ( localeName == "zh_TW" )
{
// Traditional Chinese, but drop (Taiwan) from the name
static QString name = QStringLiteral( "繁體中文" );
return { nullptr, &name };
}
return { nullptr, nullptr };
}
@ -70,11 +82,9 @@ Translation::Translation( const Id& localeId, LabelFormat format, QObject* paren
}
bool needsCountryName = ( format == LabelFormat::AlwaysWithCountry )
|| ( localeId.name.contains( '_' ) && QLocale::countriesForLanguage( m_locale.language() ).count() > 1 );
QString countryName = ( needsCountryName ?
m_locale.nativeCountryName()
: QString() );
|| ( !name && localeId.name.contains( '_' )
&& QLocale::countriesForLanguage( m_locale.language() ).count() > 1 );
QString countryName = needsCountryName ? m_locale.nativeCountryName() : QString();
m_label = needsCountryName ? longFormat.arg( languageName, countryName ) : languageName;
m_englishLabel = needsCountryName ? longFormat.arg( englishName, QLocale::countryToString( m_locale.country() ) )
: englishName;