[locale] Defer to the locale-service idea of LANG

- Using QLocale().name() loses some special locales that
  Calamares understands but Qt does not (e.g. sr@latn, ca@valencia)
  so do it in two steps.
This commit is contained in:
Adriaan de Groot 2022-06-18 11:48:50 +02:00
parent 2478570deb
commit 79db04dc2e

View File

@ -305,8 +305,14 @@ Config::automaticLocaleConfiguration() const
{ {
return LocaleConfiguration(); return LocaleConfiguration();
} }
return LocaleConfiguration::fromLanguageAndLocation(
QLocale().name(), supportedLocales(), currentLocation()->country() ); auto* gs = Calamares::JobQueue::instance()->globalStorage();
QString lang = CalamaresUtils::Locale::readGS( *gs, QStringLiteral( "LANG" ) );
if ( lang.isEmpty() )
{
lang = QLocale().name();
}
return LocaleConfiguration::fromLanguageAndLocation( lang, supportedLocales(), currentLocation()->country() );
} }
LocaleConfiguration LocaleConfiguration