This commit is contained in:
Marc Beninca 2024-09-04 14:23:15 +02:00
parent 194ff1b177
commit d592c30ffd
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -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 │
# ╰──────┴─────╯