index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2022-08-30 19:34:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 19:34:25 +0200 |
commit | f6e695871cdf55dd5277a955ff63a1ee1fd14348 (patch) | |
tree | c5ced73dd09e9fdf1d9058f358ded7acc955921f /archinstall/lib/menu | |
parent | ee64276f0e3651367de51e1423f3767dde1be525 (diff) |
-rw-r--r-- | archinstall/lib/menu/global_menu.py | 15 |
diff --git a/archinstall/lib/menu/global_menu.py b/archinstall/lib/menu/global_menu.py index f631c086..fc7c90bc 100644 --- a/archinstall/lib/menu/global_menu.py +++ b/archinstall/lib/menu/global_menu.py @@ -36,10 +36,21 @@ from ..user_interaction import add_number_of_parrallel_downloads from ..models.users import User from ..user_interaction.partitioning_conf import current_partition_layout from ..output import FormattedOutput +from ..translationhandler import Language if TYPE_CHECKING: _: Any +def display_language(global_menu, x): + if type(x) == Language: + return x + elif type(x) == str: + translation_handler = global_menu._translation_handler + for language in translation_handler._get_translations(): + if language.lang == x: + return language + else: + raise ValueError(f"Language entry needs to Language() object or string of full language like 'English'.") class GlobalMenu(GeneralMenu): def __init__(self,data_store): @@ -51,8 +62,8 @@ class GlobalMenu(GeneralMenu): self._menu_options['archinstall-language'] = \ Selector( _('Archinstall language'), - lambda x: self._select_archinstall_language(x), - display_func=lambda x: x.display_name, + lambda x: self._select_archinstall_language(display_language(self, x)), + display_func=lambda x: display_language(self, x).display_name, default=self.translation_handler.get_language('en')) self._menu_options['keyboard-layout'] = \ Selector( |