From 18de897329ba631c0014071ad367f4342033d1d9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 4 Sep 2024 12:07:25 +0200 Subject: [PATCH] spcd_txt_locale --- spcd/bootstrap.sh | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 3b510f8..fa1222f 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -378,15 +378,6 @@ spcd_txt_get() { } spcd_txt_locale() { - locale - spcd_split - local value name - if [ -n "${1}" ]; then - value="${1}" - else - value="${_SPCD_TXT_LOCALE_DEFAULT}" - fi - value="${value}.${_SPCD_TXT_CHARSET}" set -- \ "LANG" \ "LC_CTYPE" \ @@ -401,18 +392,30 @@ spcd_txt_locale() { "LC_TELEPHONE" \ "LC_MEASUREMENT" \ "LC_IDENTIFICATION" + local value name + if [ "${1}" = "set" ]; then + if [ -n "${2}" ]; then + value="${2}" + else + value="${_SPCD_TXT_LOCALE_DEFAULT}" + fi + value="${value}.${_SPCD_TXT_CHARSET}" + fi for name in "${@}"; do - export "${name}=${value}" + case "${1}" in + "list") spcd_os_printenv "${name}" ;; + "set") export "${name}=${value}" ;; + *) ;; + esac done - spcd_split - locale + if [ "${1}" = "set" ]; then + spcd_txt_locale "list" + fi } spcd_txt_locales_echo() { - case "${1}" in - "LANGUAGE") spcd_os_printenv "LANGUAGE" ;; - *) locale -a ;; - esac + spcd_os_printenv "LANGUAGE" + locale --all-locales } spcd_txt_locales() { @@ -1257,7 +1260,7 @@ spcd_step__packages_install_locales() { *) ;; esac spcd_txt_locales "LANGUAGE" - spcd_txt_locale "${SPCD_TXT_LOCALE}" + spcd_txt_locale "set" "${SPCD_TXT_LOCALE}" } spcd_step__packages_upgrade_system() { @@ -1459,7 +1462,7 @@ ${SPCD_PYTHON_ALIAS} / ${name}" spcd_main() { # environment - spcd_txt_locale + spcd_txt_locale "set" # spcd_step_in "Environment" spcd_step_in "Defaults"