Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction/locale_conf.py
blob: d48018cfeac7e7f6360f4efb3c265e24d7db340e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from __future__ import annotations

from typing import Any, TYPE_CHECKING

from ..locale_helpers import list_locales
from ..menu import Menu

if TYPE_CHECKING:
	_: Any


def select_locale_lang(default: str, preset: str = None) -> str:
	locales = list_locales()
	locale_lang = set([locale.split()[0] for locale in locales])

	selected_locale = Menu(_('Choose which locale language to use'),
							locale_lang,
							sort=True,
							preset_values=preset,
							default_option=default).run()

	return selected_locale


def select_locale_enc(default: str, preset: str = None) -> str:
	locales = list_locales()
	locale_enc = set([locale.split()[1] for locale in locales])

	selected_locale = Menu(_('Choose which locale encoding to use'),
							locale_enc,
							sort=True,
							preset_values=preset,
							default_option=default).run()

	return selected_locale