Skip to content

Commit 15b895b

Browse files
committed
Select the installer language before wifi menu
The wifi menu was always shown in English, even though translations exist. This is because it's launched before the main menu, and the user has no chance to select the archinstall language. Now there's a language selection menu before the internet connection check.
1 parent 919a435 commit 15b895b

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

archinstall/lib/general/general_menu.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ async def select_archinstall_language(languages: list[Language], preset: Languag
107107

108108
title = 'NOTE: Console font will be set automatically for supported languages.\n'
109109
title += 'For other languages, fonts can be found in "/usr/share/kbd/consolefonts"\n'
110-
title += 'and set manually with: setfont <fontname>\n'
110+
title += 'and set manually with: setfont <fontname>\n\n'
111+
title += 'Select the archinstall language'
111112

112113
result = await Selection[Language](
113114
header=title,

archinstall/main.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77
import time
88
import traceback
99
from pathlib import Path
10+
from typing import override
1011

1112
from archinstall.lib.args import ArchConfigHandler, SubCommand
1213
from archinstall.lib.disk.utils import disk_layouts
14+
from archinstall.lib.general.general_menu import select_archinstall_language
1315
from archinstall.lib.hardware import SysInfo
1416
from archinstall.lib.log import debug, error, info, logger, share_install_log, warn
1517
from archinstall.lib.menu.helpers import Confirmation
1618
from archinstall.lib.network.wifi_handler import WifiHandler
1719
from archinstall.lib.networking import ping
1820
from archinstall.lib.packages.util import check_version_upgrade
1921
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
2123
from archinstall.lib.utils.util import running_from_iso
22-
from archinstall.tui.components import tui
24+
from archinstall.tui.components import InstanceRunnable, tui
2325
from archinstall.tui.menu_item import MenuItemGroup
2426

2527

@@ -107,6 +109,15 @@ async def _confirm() -> bool:
107109
error(tr('Failed to upload log.'))
108110

109111

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+
110121
def run() -> int:
111122
"""
112123
This can either be run as the compiled and installed application: python setup.py install
@@ -140,6 +151,9 @@ def run() -> int:
140151

141152
_log_sys_info()
142153

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+
143157
if not arch_config_handler.args.offline:
144158
if not arch_config_handler.args.skip_wifi_check:
145159
wifi_handler = WifiHandler()

0 commit comments

Comments
 (0)