Install zh_CN.UTF-8 as system language for Chinese installs

The configurator wrote en_US.UTF-8 unconditionally, so a Chinese
install booted into an English system. sys_lang now follows the
installer language, and both zh_CN and en_US locales are always
generated in the target.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
2026-08-25 10:00:14 -04:00
co-authored by Claude Fable 5
parent 960e0a6211
commit e71a9de012
+66 -22
View File
@@ -47,15 +47,16 @@ index 16904f8..f1ec36e 100644
export OMARCHY_MIRROR="$(cat /root/omarchy_mirror)"
if [[ -f /root/omarchy_iso_ref ]]; then
diff --git a/configs/airootfs/root/configurator b/configs/airootfs/root/configurator
index 4cd3db3..24a1bf8 100644
index 4cd3db3..96c507e 100644
--- a/configs/airootfs/root/configurator
+++ b/configs/airootfs/root/configurator
@@ -9,6 +9,165 @@ OMARCHY_SETTINGS_PACKAGE="${OMARCHY_SETTINGS_PACKAGE:-omarchy-settings}"
@@ -9,6 +9,167 @@ OMARCHY_SETTINGS_PACKAGE="${OMARCHY_SETTINGS_PACKAGE:-omarchy-settings}"
LOGO_PATH="$OMARCHY_PATH/logo.txt"
+# Installer strings; the graphical console stage exports OMARCHY_INSTALL_LANG=zh
+if [[ ${OMARCHY_INSTALL_LANG:-} == zh ]]; then
+ SYS_LANG="zh_CN.UTF-8"
+ L_TAGLINE='华丽、现代、观点鲜明的 Linux —— 中国版'
+ L_HINT='按回车开始安装'
+ L_ABORTED='安装已中止'
@@ -134,6 +135,7 @@ index 4cd3db3..24a1bf8 100644
+ L_DS_MKESP='在 %s 创建 ESP 文件系统'
+ L_DS_MOUNTESP='挂载 ESP'
+else
+ SYS_LANG="en_US.UTF-8"
+ L_TAGLINE='Beautiful, Modern & Opinionated Linux by DHH'
+ L_HINT='Press Return to Start Install'
+ L_ABORTED='Aborted installation'
@@ -216,7 +218,7 @@ index 4cd3db3..24a1bf8 100644
# The setup form — keyboard, account, hostname, and timezone questions, plus the
# rules their answers are checked against — shared verbatim with the first-boot
# owner setup that finishes a deferred install. build-iso.sh vendors it out of
@@ -122,12 +281,12 @@ greeter() {
@@ -122,12 +283,12 @@ greeter() {
printf '\033[%d;1H' "$logo_row"
gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "$(<"$LOGO_PATH")"
@@ -233,7 +235,7 @@ index 4cd3db3..24a1bf8 100644
printf '\033[%d;%dH\033[2m%s\033[0m' "$hint_row" "$((hpad + 1))" "$hint"
# ColorShift the logo: a green base (indexed color 2) with a cyan accent (6)
@@ -176,9 +335,9 @@ greeter() {
@@ -176,9 +337,9 @@ greeter() {
}
abort() {
@@ -245,7 +247,7 @@ index 4cd3db3..24a1bf8 100644
exit 1
}
@@ -212,8 +371,8 @@ keyboard_form() {
@@ -212,8 +373,8 @@ keyboard_form() {
while true; do
clear_logo
echo
@@ -256,7 +258,7 @@ index 4cd3db3..24a1bf8 100644
echo
omarchy_prompt_keyboard && status=0 || status=$?
@@ -245,11 +404,11 @@ keyboard_form() {
@@ -245,11 +406,11 @@ keyboard_form() {
confirm_prepare_for_another_owner() {
clear_logo
echo
@@ -272,7 +274,7 @@ index 4cd3db3..24a1bf8 100644
}
# The user step. Deferred-provisioning installs skip it entirely — the machine's first owner
@@ -257,7 +416,7 @@ confirm_prepare_for_another_owner() {
@@ -257,7 +418,7 @@ confirm_prepare_for_another_owner() {
# operator sets nothing user-specific.
user_form() {
@@ -281,7 +283,7 @@ index 4cd3db3..24a1bf8 100644
# Each prompt reports 0 (set), OMARCHY_FORM_BACK (Esc), or OMARCHY_FORM_SIGNAL
# (Ctrl+C). Both non-zero cases unwind to user_step, which decides what they
@@ -291,18 +450,18 @@ user_step() {
@@ -291,18 +452,18 @@ user_step() {
fi
# Add manual padding since gum table -p doesn't respect padding
@@ -309,7 +311,7 @@ index 4cd3db3..24a1bf8 100644
break
else
keyboard_form
@@ -504,11 +663,11 @@ print_dry_run_files() {
@@ -504,11 +665,11 @@ print_dry_run_files() {
# action so users have a way to actually fix the situation.
not_enough_space() {
local available="${1:-0}"
@@ -325,7 +327,7 @@ index 4cd3db3..24a1bf8 100644
open_partition_tool
fi
return 1
@@ -518,14 +677,14 @@ not_enough_space() {
@@ -518,14 +679,14 @@ not_enough_space() {
# encryption confirm. Sets the globals run_partition_execute needs. Returns 1
# to fall back to the install-mode picker.
run_partition_decide() {
@@ -345,7 +347,7 @@ index 4cd3db3..24a1bf8 100644
fi
# Omarchy always creates its own dedicated ESP in free space and never
@@ -534,17 +693,17 @@ run_partition_decide() {
@@ -534,17 +695,17 @@ run_partition_decide() {
# Windows ESP is far too small for our Unified Kernel Images, and a shared
# ESP forces the install unencrypted. A separate Linux ESP keeps Windows
# and Omarchy fully isolated and keeps LUKS on the table.
@@ -368,7 +370,7 @@ index 4cd3db3..24a1bf8 100644
partprobe "$disk" 2>/dev/null || true
sleep 1
@@ -619,21 +778,21 @@ run_partition_decide() {
@@ -619,21 +780,21 @@ run_partition_decide() {
while true; do
clear_logo
echo
@@ -396,7 +398,7 @@ index 4cd3db3..24a1bf8 100644
confirm_status=$?
case $confirm_status in
@@ -691,9 +850,9 @@ run_partition_execute() {
@@ -691,9 +852,9 @@ run_partition_execute() {
say "[dry] partition numbers are assigned by parted at creation, then read back"
say "[dry] encrypted=$encrypt_installation kernel=$kernel_choice"
else
@@ -408,7 +410,7 @@ index 4cd3db3..24a1bf8 100644
partprobe "$disk" 2>/dev/null || true
sleep 1
fi
@@ -709,7 +868,7 @@ run_partition_execute() {
@@ -709,7 +870,7 @@ run_partition_execute() {
disk_abort_hook "Could not create the root partition on $disk"
root_part_num="$created_partition_number"
@@ -417,7 +419,7 @@ index 4cd3db3..24a1bf8 100644
parted --script "$disk" set "$efi_part_num" esp on
efi_dev=$(partition_path "$disk" "$efi_part_num")
@@ -725,11 +884,11 @@ run_partition_execute() {
@@ -725,11 +886,11 @@ run_partition_execute() {
# Both partitions are ours and brand new, but the space they occupy may
# carry signatures from whatever was deleted to free it.
@@ -432,7 +434,7 @@ index 4cd3db3..24a1bf8 100644
# Kept as pipes rather than routed through disk_step: the passphrase must
# not become an argv the process table can show. Folding stderr into
# stdout still lands any error in the install log.
@@ -746,31 +905,31 @@ run_partition_execute() {
@@ -746,31 +907,31 @@ run_partition_execute() {
root_mapper="$root_partition_device"
fi
@@ -474,7 +476,28 @@ index 4cd3db3..24a1bf8 100644
# The orchestrator's first act is to verify this handoff. Check it here so
# a failure names the step that broke rather than surfacing later as
@@ -862,7 +1021,7 @@ _EOF_
@@ -798,7 +959,10 @@ run_partition_execute() {
"auth_config": {},
"audio_config": { "audio": "pipewire" },
"bootloader_config": { "bootloader": "Limine", "uki": false, "removable": false },
- "custom_commands": [],
+ "custom_commands": [
+ "sed -i -e s/^#zh_CN.UTF-8/zh_CN.UTF-8/ -e s/^#en_US.UTF-8/en_US.UTF-8/ /etc/locale.gen",
+ "locale-gen"
+ ],
"omarchy_install": {
"mode": "protected",
"target_mount": "/mnt",
@@ -832,7 +996,7 @@ run_partition_execute() {
"locale_config": {
"kb_layout": "$keyboard",
"sys_enc": "UTF-8",
- "sys_lang": "en_US.UTF-8"
+ "sys_lang": "$SYS_LANG"
},
"mirror_config": {
"custom_repositories": [],
@@ -862,7 +1026,7 @@ _EOF_
}
disk_form() {
@@ -483,7 +506,7 @@ index 4cd3db3..24a1bf8 100644
# Don't offer the install media as an option (Arch ISO mounts it here)
local boot_source
@@ -888,19 +1047,19 @@ disk_form() {
@@ -888,19 +1052,19 @@ disk_form() {
fi
done <<<"$available_disks"
@@ -508,7 +531,7 @@ index 4cd3db3..24a1bf8 100644
clear
cfdisk "$disk" || true
@@ -933,17 +1092,17 @@ requires_full_disk_install() {
@@ -933,17 +1097,17 @@ requires_full_disk_install() {
}
install_mode_form() {
@@ -531,7 +554,7 @@ index 4cd3db3..24a1bf8 100644
}
confirm_disk_overwrite() {
@@ -953,17 +1112,17 @@ confirm_disk_overwrite() {
@@ -953,17 +1117,17 @@ confirm_disk_overwrite() {
while true; do
clear_logo
echo
@@ -554,7 +577,7 @@ index 4cd3db3..24a1bf8 100644
confirm_status=$?
case $confirm_status in
@@ -1002,13 +1161,13 @@ select_installation() {
@@ -1002,13 +1166,13 @@ select_installation() {
# With no free-space option to offer, a full-disk install is the only
# mode, so skip the picker and go straight to the overwrite confirm.
if $full_disk_only; then
@@ -570,7 +593,7 @@ index 4cd3db3..24a1bf8 100644
if confirm_disk_overwrite; then
install_target="full_disk"
return 0
@@ -1017,13 +1176,13 @@ select_installation() {
@@ -1017,13 +1181,13 @@ select_installation() {
# wants a different disk.
$full_disk_only && disk_form
;;
@@ -586,6 +609,27 @@ index 4cd3db3..24a1bf8 100644
disk_form
;;
esac
@@ -1136,7 +1300,10 @@ cat <<-_EOF_ >user_configuration.json
"auth_config": {},
"audio_config": { "audio": "pipewire" },
"bootloader_config": { "bootloader": "Limine", "uki": false, "removable": false },
- "custom_commands": [],
+ "custom_commands": [
+ "sed -i -e s/^#zh_CN.UTF-8/zh_CN.UTF-8/ -e s/^#en_US.UTF-8/en_US.UTF-8/ /etc/locale.gen",
+ "locale-gen"
+ ],
"omarchy_install": {
"mode": "full_disk",
"defer_provisioning": $defer_provisioning,
@@ -1221,7 +1388,7 @@ cat <<-_EOF_ >user_configuration.json
"locale_config": {
"kb_layout": "$keyboard",
"sys_enc": "UTF-8",
- "sys_lang": "en_US.UTF-8"
+ "sys_lang": "$SYS_LANG"
},
"mirror_config": {
"custom_repositories": [],
diff --git a/configs/airootfs/usr/local/bin/omarchy-install-dashboard b/configs/airootfs/usr/local/bin/omarchy-install-dashboard
index 91e960b..54d331d 100755
--- a/configs/airootfs/usr/local/bin/omarchy-install-dashboard