diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 4dd5e40..1e00290 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -377,54 +377,6 @@ spcd_txt_get() { esac } -spcd_txt_locale() { - local action="${1}" - local locale="${2}" - set -- \ - "LANG" \ - "LC_CTYPE" \ - "LC_NUMERIC" \ - "LC_TIME" \ - "LC_COLLATE" \ - "LC_MONETARY" \ - "LC_MESSAGES" - set -- \ - "${@}" \ - "LC_PAPER" \ - "LC_NAME" \ - "LC_ADDRESS" \ - "LC_TELEPHONE" \ - "LC_MEASUREMENT" \ - "LC_IDENTIFICATION" - local name - case "${action}" in - "list") - if ! locale; then - for name in "${@}"; do - spcd_os_printenv "${name}" - done - fi - ;; - "set") - spcd_txt_locale "list" - spcd_split - local value - if [ -n "${locale}" ]; then - value="${locale}" - else - value="${_SPCD_TXT_LOCALE_DEFAULT}" - fi - value="${value}.${_SPCD_TXT_CHARSET}" - for name in "${@}"; do - export "${name}=${value}" - done - spcd_split - spcd_txt_locale "list" - ;; - *) ;; - esac -} - spcd_txt_locales_echo() { spcd_os_printenv "LANGUAGE" locale --all-locales @@ -951,6 +903,54 @@ spcd_query_package() { esac } +spcd_txt_locale() { + local action="${1}" + local locale="${2}" + set -- \ + "LANG" \ + "LC_CTYPE" \ + "LC_NUMERIC" \ + "LC_TIME" \ + "LC_COLLATE" \ + "LC_MONETARY" \ + "LC_MESSAGES" + set -- \ + "${@}" \ + "LC_PAPER" \ + "LC_NAME" \ + "LC_ADDRESS" \ + "LC_TELEPHONE" \ + "LC_MEASUREMENT" \ + "LC_IDENTIFICATION" + local name + case "${action}" in + "list") + if ! locale; then + for name in "${@}"; do + spcd_os_printenv "${name}" + done + fi + ;; + "set") + spcd_txt_locale "list" + spcd_split + local value + if [ -n "${locale}" ]; then + value="${locale}" + else + value="${_SPCD_TXT_LOCALE_DEFAULT}" + fi + value="${value}.${_SPCD_TXT_CHARSET}" + for name in "${@}"; do + export "${name}=${value}" + done + spcd_split + spcd_txt_locale "list" + ;; + *) ;; + esac +} + # ╭──────┬─────╮ # │ step │ dns │ # ╰──────┴─────╯