From d057c6f894f3c93afabd159fdca8a4f5505a0731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Mon, 24 Aug 2026 19:26:31 -0400 Subject: [PATCH] Locale apply: escaped matching, explicit generation assertions Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp --- bin/omarchy-cn-locale-apply | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/omarchy-cn-locale-apply b/bin/omarchy-cn-locale-apply index b51d28f3..063d3e0f 100755 --- a/bin/omarchy-cn-locale-apply +++ b/bin/omarchy-cn-locale-apply @@ -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