fix_locales

This commit is contained in:
pvincent
2026-08-31 12:06:04 +04:00
parent 7e479fa011
commit 46e39d0c4c
+22
View File
@@ -230,6 +230,27 @@ function apply_mode {
fi fi
} }
function fix_locales {
local locale should_regenerate=false
declare -a expected_locales=(en_US.utf8 es_ES.utf8 fr_FR.utf8)
declare -A found_locales
for locale in "${expected_locales[@]}"; do found_locales["$locale"]=false; done
mapfile -t gen_locales < <(sudo locale -a)
for locale in "${gen_locales[@]}"; do
if [[ -v found_locales["$locale"] ]]; then found_locales["$locale"]=true; fi
done
for locale in "${!found_locales[@]}"; do
if [[ ${found_locales[$locale]} == 'false' ]]; then
echo "Locale: $locale missing"
sudo sed -i "s/^# *\(${locale:0:5}\.UTF-8\)/\1/" /etc/locale.gen
should_regenerate=true
fi
done
if [[ "$should_regenerate" == 'true' ]]; then
sudo locale-gen
fi
}
# MAIN # MAIN
source "$MIAOU_BASH_DIR"/lib/functions.bash source "$MIAOU_BASH_DIR"/lib/functions.bash
@@ -239,6 +260,7 @@ fetch_distro_like
install_required_packages install_required_packages
fix_users_bashrc fix_users_bashrc
fix_terminfo_ghostty fix_terminfo_ghostty
fix_locales
ghostty_global_config ghostty_global_config
link_config_files link_config_files
link_miaou_bash link_miaou_bash