Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2023-11-20 06:55:45 -0500
committerGitHub <noreply@github.com>2023-11-20 12:55:45 +0100
commit6ee6d1eda05d3f69f6aaabac55a741e693449994 (patch)
treecf9b82bd0d5ebe0d31adf6398ea872253f51868f /archinstall/lib
parent30a374a65b84c2d7dfbb13a4643fb27f31bc71e2 (diff)
Remove `select_language()` duplicate of `select_kb_layout()` (#2151)
* Remove `select_language()` duplicate of `select_kb_layout()` * Added a deprecation warning on select_language() * Moved select_language() back into it's original location, just to keep the PR diff minimal * Removed import for now, to please flake8 --------- Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/interactions/general_conf.py29
1 files changed, 8 insertions, 21 deletions
diff --git a/archinstall/lib/interactions/general_conf.py b/archinstall/lib/interactions/general_conf.py
index b12a6fb8..a879552e 100644
--- a/archinstall/lib/interactions/general_conf.py
+++ b/archinstall/lib/interactions/general_conf.py
@@ -3,7 +3,7 @@ from __future__ import annotations
import pathlib
from typing import List, Any, Optional, TYPE_CHECKING
-from ..locale import list_timezones, list_keyboard_languages
+from ..locale import list_timezones
from ..menu import MenuSelectionType, Menu, TextInput
from ..models.audio_configuration import Audio, AudioConfiguration
from ..output import warn
@@ -87,29 +87,16 @@ def ask_for_audio_selection(
def select_language(preset: Optional[str] = None) -> Optional[str]:
- """
- Asks the user to select a language
- Usually this is combined with :ref:`archinstall.list_keyboard_languages`.
-
- :return: The language/dictionary key of the selected language
- :rtype: str
- """
- kb_lang = list_keyboard_languages()
- # sort alphabetically and then by length
- sorted_kb_lang = sorted(kb_lang, key=lambda x: (len(x), x))
+ from ..locale.locale_menu import select_kb_layout
- choice = Menu(
- _('Select keyboard layout'),
- sorted_kb_lang,
- preset_values=preset,
- sort=False
- ).run()
+ # We'll raise an exception in an upcoming version.
+ # from ..exceptions import Deprecated
+ # raise Deprecated("select_language() has been deprecated, use select_kb_layout() instead.")
- match choice.type_:
- case MenuSelectionType.Skip: return preset
- case MenuSelectionType.Selection: return choice.single_value
+ # No need to translate this i feel, as it's a short lived message.
+ warn("select_language() is deprecated, use select_kb_layout() instead. select_language() will be removed in a future version")
- return None
+ return select_kb_layout(preset)
def select_archinstall_language(languages: List[Language], preset: Language) -> Language: