mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 18:35:37 -04:00
[welcome] Fix matched-with-a-locale
- Previously the matchLocale() function set the index in the combobox; do it separately now.
This commit is contained in:
parent
57452b8c38
commit
e5d1c0ae27
1 changed files with 10 additions and 6 deletions
|
@ -137,13 +137,13 @@ WelcomePage::initLanguages()
|
||||||
// Find the best initial translation
|
// Find the best initial translation
|
||||||
QLocale defaultLocale = QLocale( QLocale::system().name() );
|
QLocale defaultLocale = QLocale( QLocale::system().name() );
|
||||||
|
|
||||||
cDebug() << "Matching exact locale" << defaultLocale;
|
cDebug() << "Matching locale" << defaultLocale;
|
||||||
int matchedLocaleIndex = m_languages->find(
|
int matchedLocaleIndex = m_languages->find(
|
||||||
[&](const QLocale& x){ return x.language() == defaultLocale.language() && x.country() == defaultLocale.country(); } );
|
[&](const QLocale& x){ return x.language() == defaultLocale.language() && x.country() == defaultLocale.country(); } );
|
||||||
|
|
||||||
if ( matchedLocaleIndex < 0 )
|
if ( matchedLocaleIndex < 0 )
|
||||||
{
|
{
|
||||||
cDebug() << "Matching approximate locale" << defaultLocale.language();
|
cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language();
|
||||||
|
|
||||||
matchedLocaleIndex = m_languages->find(
|
matchedLocaleIndex = m_languages->find(
|
||||||
[&](const QLocale& x){ return x.language() == defaultLocale.language(); } );
|
[&](const QLocale& x){ return x.language() == defaultLocale.language(); } );
|
||||||
|
@ -153,7 +153,7 @@ WelcomePage::initLanguages()
|
||||||
{
|
{
|
||||||
QLocale en_us( QLocale::English, QLocale::UnitedStates );
|
QLocale en_us( QLocale::English, QLocale::UnitedStates );
|
||||||
|
|
||||||
cDebug() << "Matching English (US)";
|
cDebug() << Logger::SubEntry << "Matching English (US)";
|
||||||
matchedLocaleIndex = m_languages->find( en_us );
|
matchedLocaleIndex = m_languages->find( en_us );
|
||||||
|
|
||||||
// Now, if it matched, because we didn't match the system locale, switch to the one found
|
// Now, if it matched, because we didn't match the system locale, switch to the one found
|
||||||
|
@ -162,9 +162,13 @@ WelcomePage::initLanguages()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( matchedLocaleIndex >= 0 )
|
if ( matchedLocaleIndex >= 0 )
|
||||||
CalamaresUtils::installTranslator( m_languages->locale( matchedLocaleIndex ).name(),
|
{
|
||||||
Calamares::Branding::instance()->translationsPathPrefix(),
|
QString name = m_languages->locale( matchedLocaleIndex ).name();
|
||||||
qApp );
|
cDebug() << Logger::SubEntry << "Matched with index" << matchedLocaleIndex << name;
|
||||||
|
|
||||||
|
CalamaresUtils::installTranslator( name, Calamares::Branding::instance()->translationsPathPrefix(), qApp );
|
||||||
|
ui->languageWidget->setCurrentIndex( matchedLocaleIndex );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cWarning() << "No available translation matched" << defaultLocale;
|
cWarning() << "No available translation matched" << defaultLocale;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue