Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu/selection_menu.py
diff options
context:
space:
mode:
authorDaniel <blackrabbit256@gmail.com>2022-02-05 10:27:29 +1100
committerGitHub <noreply@github.com>2022-02-05 00:27:29 +0100
commitf6d133804b7fdfab5a00d95a1985c3e220935ac1 (patch)
tree7eeeedf57b2d8068ce8f382ebbe830af77f58df0 /archinstall/lib/menu/selection_menu.py
parent68c2988358426e8d0074479cef539ddadc2a31e6 (diff)
Provide nationalization (#893)
* Nationalization * Add _ as builtins to flake8 * Removing conflict hash tag Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'archinstall/lib/menu/selection_menu.py')
-rw-r--r--archinstall/lib/menu/selection_menu.py50
1 files changed, 32 insertions, 18 deletions
diff --git a/archinstall/lib/menu/selection_menu.py b/archinstall/lib/menu/selection_menu.py
index 940941be..f3fd3b4c 100644
--- a/archinstall/lib/menu/selection_menu.py
+++ b/archinstall/lib/menu/selection_menu.py
@@ -27,6 +27,8 @@ from ..user_interaction import select_kernel
from ..user_interaction import select_encrypted_partitions
from ..user_interaction import select_harddrives
from ..user_interaction import select_profile
+from ..user_interaction import select_archinstall_language
+from ..translation import Translation
class Selector:
def __init__(
@@ -128,29 +130,36 @@ class Selector:
class GlobalMenu:
def __init__(self):
+ self._translation = Translation.load_nationalization()
self._menu_options = {}
self._setup_selection_menu_options()
def _setup_selection_menu_options(self):
+ self._menu_options['archinstall-language'] = \
+ Selector(
+ _('Select Archinstall language'),
+ lambda: self._select_archinstall_language('English'),
+ default='English',
+ enabled=True)
self._menu_options['keyboard-layout'] = \
- Selector('Select keyboard layout', lambda: select_language('us'), default='us')
+ Selector(_('Select keyboard layout'), lambda: select_language('us'), default='us')
self._menu_options['mirror-region'] = \
Selector(
- 'Select mirror region',
+ _('Select mirror region'),
lambda: select_mirror_regions(),
display_func=lambda x: list(x.keys()) if x else '[]',
default={})
self._menu_options['sys-language'] = \
- Selector('Select locale language', lambda: select_locale_lang('en_US'), default='en_US')
+ Selector(_('Select locale language'), lambda: select_locale_lang('en_US'), default='en_US')
self._menu_options['sys-encoding'] = \
- Selector('Select locale encoding', lambda: select_locale_enc('utf-8'), default='utf-8')
+ Selector(_('Select locale encoding'), lambda: select_locale_enc('utf-8'), default='utf-8')
self._menu_options['harddrives'] = \
Selector(
- 'Select harddrives',
+ _('Select harddrives'),
lambda: self._select_harddrives())
self._menu_options['disk_layouts'] = \
Selector(
- 'Select disk layout',
+ _('Select disk layout'),
lambda: select_disk_layout(
storage['arguments'].get('harddrives', []),
storage['arguments'].get('advanced', False)
@@ -158,60 +167,60 @@ class GlobalMenu:
dependencies=['harddrives'])
self._menu_options['!encryption-password'] = \
Selector(
- 'Set encryption password',
+ _('Set encryption password'),
lambda: get_password(prompt='Enter disk encryption password (leave blank for no encryption): '),
display_func=lambda x: self._secret(x) if x else 'None',
dependencies=['harddrives'])
self._menu_options['swap'] = \
Selector(
- 'Use swap',
+ _('Use swap'),
lambda: ask_for_swap(),
default=True)
self._menu_options['bootloader'] = \
Selector(
- 'Select bootloader',
+ _('Select bootloader'),
lambda: ask_for_bootloader(storage['arguments'].get('advanced', False)),)
self._menu_options['hostname'] = \
Selector('Specify hostname', lambda: ask_hostname())
self._menu_options['!root-password'] = \
Selector(
- 'Set root password',
+ _('Set root password'),
lambda: self._set_root_password(),
display_func=lambda x: self._secret(x) if x else 'None')
self._menu_options['!superusers'] = \
Selector(
- 'Specify superuser account',
+ _('Specify superuser account'),
lambda: self._create_superuser_account(),
dependencies_not=['!root-password'],
display_func=lambda x: list(x.keys()) if x else '')
self._menu_options['!users'] = \
Selector(
- 'Specify user account',
+ _('Specify user account'),
lambda: self._create_user_account(),
default={},
display_func=lambda x: list(x.keys()) if x else '[]')
self._menu_options['profile'] = \
Selector(
- 'Specify profile',
+ _('Specify profile'),
lambda: self._select_profile(),
display_func=lambda x: x if x else 'None')
self._menu_options['audio'] = \
Selector(
- 'Select audio',
+ _('Select audio'),
lambda: ask_for_audio_selection(is_desktop_profile(storage['arguments'].get('profile', None))))
self._menu_options['kernels'] = \
Selector(
- 'Select kernels',
+ _('Select kernels'),
lambda: select_kernel(),
default=['linux'])
self._menu_options['packages'] = \
Selector(
- 'Additional packages to install',
+ _('Additional packages to install'),
lambda: ask_additional_packages_to_install(storage['arguments'].get('packages', None)),
default=[])
self._menu_options['nic'] = \
Selector(
- 'Configure network',
+ _('Configure network'),
lambda: ask_to_configure_network(),
display_func=lambda x: x if x else 'Not configured, unavailable unless setup manually',
default={})
@@ -219,7 +228,7 @@ class GlobalMenu:
Selector('Select timezone', lambda: ask_for_a_timezone())
self._menu_options['ntp'] = \
Selector(
- 'Set automatic time sync (NTP)',
+ _('Set automatic time sync (NTP)'),
lambda: self._select_ntp(),
default=True)
self._menu_options['install'] = \
@@ -323,6 +332,11 @@ class GlobalMenu:
return missing
+ def _select_archinstall_language(self, default_lang):
+ language = select_archinstall_language(default_lang)
+ self._translation.activate(language)
+ return language
+
def _set_root_password(self):
prompt = 'Enter root password (leave blank to disable root & create superuser): '
password = get_password(prompt=prompt)