[welcome] Lookup GeoIP language and pass to language widget

- FIXES #934
 - Whether this is really wanted depends on the distro, and I'm not
   100% convinced the likely tags from Unicode are correct (or it'd
   take a lot more data). In any case, starting Calamares in "NL"
   gets me "nl_NL" as translation; presumably starting it in "BE"
   will get me that as well (what about Les Wallons?)
 - This also shows off that it's a real hack to have so much program
   logic in the *widget* parts of each ViewStep. Longer-term,
   a lot of functionality should go to the ViewStep itself, which
   will then control the UI.
This commit is contained in:
Adriaan de Groot 2019-05-10 15:02:12 -04:00
parent 03f88b3ed6
commit f18f9dcd14
3 changed files with 18 additions and 2 deletions

View file

@ -161,5 +161,11 @@ WelcomeViewStep::setCountry( const QString& countryCode )
return;
}
else
cDebug() << "Would like to select" << c_l;
{
int r = CalamaresUtils::Locale::availableTranslations()->find( countryCode );
if ( r < 0 )
cDebug() << "Unusable country code" << countryCode << "(no suitable translation)";
if ( ( r >= 0 ) && m_widget )
m_widget->externallySelectedLanguage( r );
}
}