|
7 | 7 | import time |
8 | 8 | import traceback |
9 | 9 | from pathlib import Path |
| 10 | +from typing import override |
10 | 11 |
|
11 | 12 | from archinstall.lib.args import ArchConfigHandler, SubCommand |
12 | 13 | from archinstall.lib.disk.utils import disk_layouts |
| 14 | +from archinstall.lib.general.general_menu import select_archinstall_language |
13 | 15 | from archinstall.lib.hardware import SysInfo |
14 | 16 | from archinstall.lib.log import debug, error, info, logger, share_install_log, warn |
15 | 17 | from archinstall.lib.menu.helpers import Confirmation |
16 | 18 | from archinstall.lib.network.wifi_handler import WifiHandler |
17 | 19 | from archinstall.lib.networking import ping |
18 | 20 | from archinstall.lib.packages.util import check_version_upgrade |
19 | 21 | from archinstall.lib.pacman.pacman import Pacman |
20 | | -from archinstall.lib.translationhandler import tr, translation_handler |
| 22 | +from archinstall.lib.translationhandler import Language, tr, translation_handler |
21 | 23 | from archinstall.lib.utils.util import running_from_iso |
22 | | -from archinstall.tui.components import tui |
| 24 | +from archinstall.tui.components import InstanceRunnable, tui |
23 | 25 | from archinstall.tui.menu_item import MenuItemGroup |
24 | 26 |
|
25 | 27 |
|
@@ -107,6 +109,15 @@ async def _confirm() -> bool: |
107 | 109 | error(tr('Failed to upload log.')) |
108 | 110 |
|
109 | 111 |
|
| 112 | +class LangSelect(InstanceRunnable[Language]): |
| 113 | + @override |
| 114 | + async def run(self) -> Language: |
| 115 | + preset_lang = translation_handler.get_language_by_name('English') |
| 116 | + selected_lang = await select_archinstall_language(translation_handler.translated_languages, preset_lang) |
| 117 | + translation_handler.activate(selected_lang) |
| 118 | + return selected_lang |
| 119 | + |
| 120 | + |
110 | 121 | def run() -> int: |
111 | 122 | """ |
112 | 123 | This can either be run as the compiled and installed application: python setup.py install |
@@ -140,6 +151,9 @@ def run() -> int: |
140 | 151 |
|
141 | 152 | _log_sys_info() |
142 | 153 |
|
| 154 | + # The main menu isn't shown if there's no internet, and so the user wouldn't be able to select a language if not for this. |
| 155 | + arch_config_handler.config.archinstall_language = tui.run(LangSelect()) |
| 156 | + |
143 | 157 | if not arch_config_handler.args.offline: |
144 | 158 | if not arch_config_handler.args.skip_wifi_check: |
145 | 159 | wifi_handler = WifiHandler() |
|
0 commit comments