From 79db04dc2eb00b354044f73c054a94fe2b9f9aae Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 18 Jun 2022 11:48:50 +0200 Subject: [PATCH] [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. --- src/modules/locale/Config.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index 5888fd071..b6378b03d 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -305,8 +305,14 @@ Config::automaticLocaleConfiguration() const { 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