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.
This commit is contained in:
Carlos Nihelton 2021-10-26 15:08:04 -03:00
parent 8b996f9ba5
commit 9f52bd92bf
1 changed files with 4 additions and 2 deletions

View File

@ -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)