From 9f52bd92bf3954e59f2cb130cb1c4cf7df6658dc Mon Sep 17 00:00:00 2001 From: Carlos Nihelton Date: Tue, 26 Oct 2021 15:08:04 -0300 Subject: [PATCH] LocaleController.start() check model language - This is just a preparation for a feature which affects system_setup. - The proposed change enables locale controller to respect the model selected_language if initialized before LocaleController.start(). - This will be used in the feature which will allow prefilling installation UI screens during WSL installation with information acquired from Windows environment. --- subiquity/server/controllers/locale.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subiquity/server/controllers/locale.py b/subiquity/server/controllers/locale.py index 064d0888..4a0a39bd 100644 --- a/subiquity/server/controllers/locale.py +++ b/subiquity/server/controllers/locale.py @@ -36,8 +36,10 @@ class LocaleController(SubiquityController): os.environ["LANG"] = data def start(self): - self.model.selected_language = os.environ.get("LANG") \ - or self.autoinstall_default + # Language may have been initialized before start() is called. + if self.model.selected_language == None: + self.model.selected_language = os.environ.get("LANG") \ + or self.autoinstall_default self.app.aio_loop.create_task(self.configured()) self.app.hub.subscribe( (InstallerChannels.CONFIGURED, 'source'), self._set_source)