spcd_txt_locales

This commit is contained in:
Marc Beninca 2024-09-01 19:01:54 +02:00
parent 7fc27c2733
commit 5324148136
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -343,7 +343,6 @@ spcd_txt_get() {
}
spcd_txt_locale() {
# LANGUAGE
local value name
if [ -n "${1}" ]; then
value="${1}"
@ -370,6 +369,43 @@ spcd_txt_locale() {
done
}
spcd_txt_locales() {
set -- \
"${SPCD_TXT_LOCALE_ENGLISH}" \
"${SPCD_TXT_LOCALE_FRENCH}"
local locale
case "${1}" in
"glibc-langpack-")
local language
for locale in "${@}"; do
language="$(echo "${locale}" | cut -d _ -f 1)"
spcd_install_package "glibc-langpack-${language}"
done
;;
"LANGUAGE")
local text
for locale in "${@}"; do
if [ -n "${text}" ]; then
text="${text}:${locale}"
else
text="${locale}"
fi
done
export LANGUAGE="${text}"
;;
"locale.gen")
local text
for locale in "${@}"; do
text="${text}\
${locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
"
done
spcd_os_write "/etc/locale.gen" "${text}"
;;
*) ;;
esac
}
# ╭──────╮
# │ step │
# ╰──────╯
@ -1178,32 +1214,20 @@ spcd_step__packages_verify_https() {
spcd_step__packages_install_locales() {
spcd_step "Install locales"
set -- \
"${SPCD_TXT_LOCALE_ENGLISH}" \
"${SPCD_TXT_LOCALE_FRENCH}"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_install_package "musl-locales" ;;
"${SPCD_PM_APT}")
local locale text
for locale in "${@}"; do
text="${text}\
${locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
"
done
spcd_os_write "/etc/locale.gen" "${text}"
spcd_txt_locales "locale.gen"
spcd_install_package "locales"
;;
"${SPCD_PM_DNF}")
local locale language
for locale in "${@}"; do
language="$(echo "${locale}" | cut -d _ -f 1)"
spcd_install_package "glibc-langpack-${language}"
done
spcd_txt_locales "glibc-langpack-"
;;
"${SPCD_PM_PACMAN}") spcd_install_package "glibc-locales" ;;
"${SPCD_PM_ZYPPER}") spcd_install_package "glibc-locale" ;;
*) ;;
esac
spcd_txt_locales "LANGUAGE"
spcd_txt_locale "${SPCD_TXT_LOCALE}"
}