Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/menu')
-rw-r--r--archinstall/lib/menu/global_menu.py15
1 files changed, 13 insertions, 2 deletions
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(