Locale apply: escaped matching, explicit generation assertions

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
2026-08-24 19:26:31 -04:00
co-authored by Claude Fable 5
parent 843769bf77
commit d057c6f894
+11 -4
View File
@@ -5,11 +5,18 @@
set -euo pipefail
for loc in "zh_CN.UTF-8 UTF-8" "en_US.UTF-8 UTF-8"; do
if ! grep -qE "^${loc% *}" /etc/locale.gen; then
echo "$loc" | sudo tee -a /etc/locale.gen > /dev/null
for loc in zh_CN en_US; do
if ! grep -qE "^${loc}\.UTF-8 UTF-8" /etc/locale.gen; then
echo "${loc}.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen > /dev/null
fi
done
sudo locale-gen
echo "Locales available: $(locale -a | grep -cE 'zh_CN|en_US') (zh_CN/en_US variants)"
for loc in zh_CN en_US; do
if ! locale -a | grep -qiE "^${loc}\.utf-?8$"; then
echo "FAIL locale: ${loc}.UTF-8 not generated" >&2
exit 1
fi
echo "PASS locale: ${loc}.UTF-8"
done