Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/locale
diff options
context:
space:
mode:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2023-10-09 06:40:59 -0400
committerGitHub <noreply@github.com>2023-10-09 21:40:59 +1100
commitdc69acd4b43931f9fd3a267d78834d1a38fbb10f (patch)
tree2b773ea48d70c45a4c3381963d74e9ca136f7968 /archinstall/lib/locale
parentedbc13590366e93bb8a85eacf104d5613bc5793a (diff)
Fix keyboard layout and timezone menus (#2153)
Diffstat (limited to 'archinstall/lib/locale')
-rw-r--r--archinstall/lib/locale/locale_menu.py2
-rw-r--r--archinstall/lib/locale/utils.py23
2 files changed, 11 insertions, 14 deletions
diff --git a/archinstall/lib/locale/locale_menu.py b/archinstall/lib/locale/locale_menu.py
index 729b3b6e..75cc1332 100644
--- a/archinstall/lib/locale/locale_menu.py
+++ b/archinstall/lib/locale/locale_menu.py
@@ -139,7 +139,7 @@ def select_kb_layout(preset: Optional[str] = None) -> Optional[str]:
"""
kb_lang = list_keyboard_languages()
# sort alphabetically and then by length
- sorted_kb_lang = sorted(sorted(list(kb_lang)), key=len)
+ sorted_kb_lang = sorted(kb_lang, key=lambda x: (len(x), x))
choice = Menu(
_('Select keyboard layout'),
diff --git a/archinstall/lib/locale/utils.py b/archinstall/lib/locale/utils.py
index 330ca0ce..d7641d50 100644
--- a/archinstall/lib/locale/utils.py
+++ b/archinstall/lib/locale/utils.py
@@ -1,16 +1,15 @@
-from typing import Iterator, List
+from typing import List
from ..exceptions import ServiceException, SysCallError
from ..general import SysCommand
from ..output import error
-def list_keyboard_languages() -> Iterator[str]:
- for line in SysCommand(
+def list_keyboard_languages() -> List[str]:
+ return SysCommand(
"localectl --no-pager list-keymaps",
environment_vars={'SYSTEMD_COLORS': '0'}
- ).decode():
- yield line
+ ).decode().splitlines()
def list_locales() -> List[str]:
@@ -24,12 +23,11 @@ def list_locales() -> List[str]:
return locales
-def list_x11_keyboard_languages() -> Iterator[str]:
- for line in SysCommand(
+def list_x11_keyboard_languages() -> List[str]:
+ return SysCommand(
"localectl --no-pager list-x11-keymap-layouts",
environment_vars={'SYSTEMD_COLORS': '0'}
- ).decode():
- yield line
+ ).decode().splitlines()
def verify_keyboard_layout(layout :str) -> bool:
@@ -62,9 +60,8 @@ def set_kb_layout(locale :str) -> bool:
return False
-def list_timezones() -> Iterator[str]:
- for line in SysCommand(
+def list_timezones() -> List[str]:
+ return SysCommand(
"timedatectl --no-pager list-timezones",
environment_vars={'SYSTEMD_COLORS': '0'}
- ).decode():
- yield line
+ ).decode().splitlines()