From 79a91b486a591494b7b8b2447b19da515ea2e595 Mon Sep 17 00:00:00 2001 From: tjpark88 Date: Thu, 30 Dec 2021 17:40:26 +0900 Subject: [PATCH 1/4] [locale] Update language always onActivate of locale updates the language only when currentLocation changed or when onActivate of locale is called for the first time. However, It is irrelevant solution since the language is set by the welcome. So language should be updated always. The language is used by keyboard module to guessing a layout of keyboard. Once you face the locale, you can't change language in the welcome if you don't change the timezone. --- src/modules/locale/Config.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index ce48edd82..c8245e4eb 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -252,15 +252,21 @@ Config::setCurrentLocation( const QString& regionName, const QString& zoneName ) void Config::setCurrentLocation( const CalamaresUtils::Locale::TimeZoneData* location ) { - if ( location != m_currentLocation ) + bool updateLocation = ( location != m_currentLocation ); + if ( updateLocation ) { m_currentLocation = location; - // Overwrite those settings that have not been made explicit. - auto newLocale = automaticLocaleConfiguration(); - if ( !m_selectedLocaleConfiguration.explicit_lang ) - { - setLanguage( newLocale.language() ); - } + } + + // Always lang should be updated + auto newLocale = automaticLocaleConfiguration(); + if ( !m_selectedLocaleConfiguration.explicit_lang ) + { + setLanguage( newLocale.language() ); + } + + if ( updateLocation ) + { if ( !m_selectedLocaleConfiguration.explicit_lc ) { m_selectedLocaleConfiguration.lc_numeric = newLocale.lc_numeric; From 6101dd90799fec671aaaaaa2d341ab1088facf84 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 17 Jan 2022 13:11:42 +0100 Subject: [PATCH 2/4] [locale] Code style --- src/modules/locale/Config.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index c8245e4eb..22a942b2a 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -252,13 +252,13 @@ Config::setCurrentLocation( const QString& regionName, const QString& zoneName ) void Config::setCurrentLocation( const CalamaresUtils::Locale::TimeZoneData* location ) { - bool updateLocation = ( location != m_currentLocation ); + const bool updateLocation = ( location != m_currentLocation ); if ( updateLocation ) { m_currentLocation = location; } - // Always lang should be updated + // lang should be always be updated auto newLocale = automaticLocaleConfiguration(); if ( !m_selectedLocaleConfiguration.explicit_lang ) { From 85a3d1dc847f5a9ee8c6afe68ed831d159ed2770 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 17 Jan 2022 13:19:25 +0100 Subject: [PATCH 3/4] Changes: document locale fix --- CHANGES-3.2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES-3.2 b/CHANGES-3.2 index 4ab226302..1fc05cd84 100644 --- a/CHANGES-3.2 +++ b/CHANGES-3.2 @@ -14,6 +14,7 @@ This release contains contributions from (alphabetically by first name): - Erik Dubois - Evan James - Johannes Kamprad + - Taejun Park (new contributor, welcome!) **Replacement notice:** The *umount* module will be replaced by a C++ implementation in the next release. The "preserve log file" feature @@ -38,6 +39,10 @@ will be removed in that release. Use the *preservefiles* module instead. module. (Thanks Erik and Joe for testing) #1851 - *umount* is now marked as an emergency module in the example configuration, since it should **probably** be run as a cleanup. (Thanks Evan) + - *welcome* and *locale* could be confusing, together, and configure + the target system with a language that does not match the installer + language, even though the user did not make any explicit choice. + (Thanks Taejun) #1864 # 3.2.49.1 (2021-12-11) # From da2612d2d9a8a7ed1e9542d2c4a2ce4c78a5b01f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 18 Jan 2022 12:28:57 +0100 Subject: [PATCH 4/4] [locale] Update language even if there is a current location - the first time we arrive at locale, there isn't a current location and the setCurrentLocation(...) method ends up calling setLanguage(), usually. The second time, this call is skipped (not called from the overloaded setCurrentLocation() which is called from onActivate), so the language didn't update. - now call setLanguage() unless there has been one set explicitly. --- src/modules/locale/Config.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index 22a942b2a..8593f8385 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -221,6 +221,11 @@ Config::setCurrentLocation() { setCurrentLocation( m_startingTimezone.first, m_startingTimezone.second ); } + if ( !m_selectedLocaleConfiguration.explicit_lang ) + { + auto newLocale = automaticLocaleConfiguration(); + setLanguage( newLocale.language() ); + } } void