Make the first screen a language choice; Chinese gets the CJK console and zh_CN
The CJK console unpacks Noto Sans Mono CJK from the offline mirror instead of shipping fonts in the live image, lists only US-keymap keyboards and preselects Pinyin. The target's LANG comes through locale_config.
This commit is contained in:
1 parent
e8715fc888
commit
25cebcf3fd
7 files changed
+107
-74
No files matched your search
@@ -94,6 +94,16 @@ warm_offline_mirror &
|
||||
warm_pid=$!
|
||||
trap 'kill "$warm_pid" 2>/dev/null' EXIT
|
||||
|
||||
# The CJK console's font comes from the offline mirror's noto-fonts-cjk, not the live image.
|
||||
unpack_cjk_font() {
|
||||
local packages=(/var/cache/omarchy/mirror/offline/noto-fonts-cjk-*.pkg.tar.zst)
|
||||
if ((${#packages[@]} != 1)) || [[ ! -f ${packages[0]} ]]; then
|
||||
echo "Expected one noto-fonts-cjk package in the offline mirror, found: ${packages[*]}" >&2
|
||||
return 1
|
||||
fi
|
||||
bsdtar -xf "${packages[0]}" -C / usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc
|
||||
}
|
||||
|
||||
cd /root
|
||||
# Autoinstall: a cidata drive carrying the configurator's own output files
|
||||
# stands in for the wizard. omarchy-cidata-load copies them into /root and
|
||||
@@ -102,7 +112,7 @@ if /usr/local/bin/omarchy-cidata-load; then
|
||||
echo "Autoinstall configuration found on cidata drive; skipping the configurator."
|
||||
export OMARCHY_UI_INTERACTIVE=no
|
||||
else
|
||||
# China moves to cage + foot, which draw Chinese; Global moves back to the VT, which applies keymaps.
|
||||
# Chinese moves to cage + foot, which draw Chinese; English moves back to the VT, which applies keymaps.
|
||||
cjk_relaunch=10
|
||||
vt_return=11
|
||||
if [[ -n ${OMARCHY_CJK_CONSOLE:-} ]]; then
|
||||
@@ -115,17 +125,23 @@ else
|
||||
cjk_runtime=/run/omarchy-cjk-console
|
||||
mkdir -p -m 700 "$cjk_runtime"
|
||||
rm -f "$cjk_runtime/cjk-console-started" "$cjk_runtime/return-to-vt"
|
||||
if ! unpack_cjk_font; then
|
||||
echo "The Chinese font could not be unpacked from the offline mirror; continuing in English."
|
||||
unset OMARCHY_CJK_RELAUNCH
|
||||
OMARCHY_INSTALL_LANGUAGE=zh ./configurator && status=0 || status=$?
|
||||
continue
|
||||
fi
|
||||
cage_status=0
|
||||
env -u OMARCHY_CJK_RELAUNCH XDG_RUNTIME_DIR=$cjk_runtime OMARCHY_CJK_CONSOLE=1 OMARCHY_INSTALL_REGION=cn \
|
||||
env -u OMARCHY_CJK_RELAUNCH XDG_RUNTIME_DIR=$cjk_runtime OMARCHY_CJK_CONSOLE=1 OMARCHY_INSTALL_LANGUAGE=zh \
|
||||
LANG=C.UTF-8 WLR_RENDERER=pixman cage -- foot -c /usr/share/omarchy-iso/foot.ini "$0" || cage_status=$?
|
||||
if [[ -f $cjk_runtime/return-to-vt ]]; then
|
||||
OMARCHY_INSTALL_REGION=global ./configurator && status=0 || status=$?
|
||||
OMARCHY_INSTALL_LANGUAGE=en ./configurator && status=0 || status=$?
|
||||
elif [[ -f $cjk_runtime/cjk-console-started ]]; then
|
||||
exit "$cage_status"
|
||||
else
|
||||
echo "The Chinese console could not start (cage exit $cage_status); continuing in English."
|
||||
unset OMARCHY_CJK_RELAUNCH
|
||||
OMARCHY_INSTALL_REGION=cn ./configurator && status=0 || status=$?
|
||||
OMARCHY_INSTALL_LANGUAGE=zh ./configurator && status=0 || status=$?
|
||||
fi
|
||||
done
|
||||
if [[ -n ${OMARCHY_CJK_CONSOLE:-} ]] && ((status == vt_return)); then
|
||||
|
||||
@@ -45,8 +45,6 @@ OMARCHY_ZH+=(
|
||||
["Hostname"]="主机名"
|
||||
["Keyboard"]="键盘"
|
||||
["Region"]="区域"
|
||||
["Global"]="全球"
|
||||
["China"]="中国"
|
||||
["[Skipped]"]="[已跳过]"
|
||||
["Yes"]="是"
|
||||
["No, change it"]="否,去修改"
|
||||
@@ -271,15 +269,24 @@ notice() {
|
||||
|
||||
# STEP 1: KEYBOARD LAYOUT
|
||||
|
||||
# .automated_script.sh moves China into the CJK console and Global back to the VT, which applies keymaps.
|
||||
apply_region_language() {
|
||||
if [[ $region == "cn" && -n ${OMARCHY_CJK_RELAUNCH:-} ]]; then
|
||||
# The target's LANG follows the language picked on the first screen.
|
||||
target_lang() {
|
||||
if [[ $language == "zh" ]]; then
|
||||
echo zh_CN.UTF-8
|
||||
else
|
||||
echo en_US.UTF-8
|
||||
fi
|
||||
}
|
||||
|
||||
# .automated_script.sh moves Chinese into the CJK console and English back to the VT, which applies keymaps.
|
||||
apply_language() {
|
||||
if [[ $language == "zh" && -n ${OMARCHY_CJK_RELAUNCH:-} ]]; then
|
||||
exit "$OMARCHY_CJK_RELAUNCH"
|
||||
fi
|
||||
if [[ $region == "global" && -n ${OMARCHY_VT_RETURN:-} ]]; then
|
||||
if [[ $language == "en" && -n ${OMARCHY_VT_RETURN:-} ]]; then
|
||||
exit "$OMARCHY_VT_RETURN"
|
||||
fi
|
||||
if [[ $region == "cn" && -n ${OMARCHY_CJK_CONSOLE:-} ]]; then
|
||||
if [[ $language == "zh" && -n ${OMARCHY_CJK_CONSOLE:-} ]]; then
|
||||
export OMARCHY_INSTALL_LANG=zh
|
||||
else
|
||||
unset OMARCHY_INSTALL_LANG
|
||||
@@ -299,16 +306,14 @@ keyboard_form() {
|
||||
say --foreground 8 "$(omarchy_text "Press Ctrl+C to prepare this machine for another owner.")"
|
||||
echo
|
||||
|
||||
omarchy_prompt_region && status=0 || status=$?
|
||||
omarchy_prompt_language && status=0 || status=$?
|
||||
if ((status == 0)); then
|
||||
apply_region_language
|
||||
# cage keeps its US layout, so the CJK console offers no other.
|
||||
if [[ -n ${OMARCHY_CJK_CONSOLE:-} ]]; then
|
||||
keyboard="us"
|
||||
keyboard_label="English (US)"
|
||||
else
|
||||
omarchy_prompt_keyboard && status=0 || status=$?
|
||||
fi
|
||||
apply_language
|
||||
local layouts=$OMARCHY_KEYBOARD_LAYOUTS selected="English (US)"
|
||||
[[ $language == "zh" ]] && selected="Chinese (Simplified, Pinyin)"
|
||||
# cage keeps its US layout, so the CJK console offers only US-keymap keyboards.
|
||||
[[ -n ${OMARCHY_CJK_CONSOLE:-} ]] && layouts=$(awk -F'|' '$2 == "us"' <<<"$layouts")
|
||||
OMARCHY_KEYBOARD_LAYOUTS=$layouts omarchy_prompt_keyboard "$selected" && status=0 || status=$?
|
||||
fi
|
||||
((status == 0)) && break
|
||||
|
||||
@@ -385,10 +390,10 @@ user_step() {
|
||||
|
||||
# The timezone selects the region (mirrors and repositories), using the
|
||||
# same lookup as the orchestrator. Global installs get no extra row.
|
||||
local summary_region region_row=""
|
||||
summary_region=$(cd /usr/share/omarchy-iso 2>/dev/null && python -m orchestrator.region "$timezone") || summary_region="global"
|
||||
if [[ $summary_region != "global" ]]; then
|
||||
region_row="\n$(omarchy_text Region),$summary_region"
|
||||
region=$(cd /usr/share/omarchy-iso 2>/dev/null && python -m orchestrator.region "$timezone") || region="global"
|
||||
region_row=""
|
||||
if [[ $region != "global" ]]; then
|
||||
region_row="\n$(omarchy_text Region),$region"
|
||||
fi
|
||||
|
||||
# Add manual padding since gum table -p doesn't respect padding
|
||||
@@ -937,7 +942,7 @@ run_partition_execute() {
|
||||
"locale_config": {
|
||||
"kb_layout": "$keyboard",
|
||||
"sys_enc": "UTF-8",
|
||||
"sys_lang": "en_US.UTF-8"
|
||||
"sys_lang": "$(target_lang)"
|
||||
},
|
||||
"mirror_config": {
|
||||
"custom_repositories": [],
|
||||
@@ -1139,15 +1144,15 @@ select_installation() {
|
||||
|
||||
defer_provisioning=false
|
||||
install_target="full_disk"
|
||||
# A rerun arrives with the console language chosen; otherwise Global.
|
||||
region="${OMARCHY_INSTALL_REGION:-global}"
|
||||
# A rerun arrives with the language chosen; otherwise English.
|
||||
language="${OMARCHY_INSTALL_LANGUAGE:-en}"
|
||||
|
||||
# Let the live VT reach its settled width before the first screen so the logo
|
||||
# isn't measured against the transient 80-column boot console.
|
||||
wait_for_stable_terminal
|
||||
|
||||
if [[ -n ${OMARCHY_INSTALL_REGION:-} ]]; then
|
||||
apply_region_language
|
||||
if [[ -n ${OMARCHY_INSTALL_LANGUAGE:-} ]]; then
|
||||
apply_language
|
||||
else
|
||||
greeter
|
||||
fi
|
||||
@@ -1336,7 +1341,7 @@ cat <<-_EOF_ >user_configuration.json
|
||||
"locale_config": {
|
||||
"kb_layout": "$keyboard",
|
||||
"sys_enc": "UTF-8",
|
||||
"sys_lang": "en_US.UTF-8"
|
||||
"sys_lang": "$(target_lang)"
|
||||
},
|
||||
"mirror_config": {
|
||||
"custom_repositories": [],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# The China installer's console: the VT's Tokyo Night palette, with CJK from wqy-microhei.
|
||||
# The Chinese installer's console: the VT's Tokyo Night palette, with Noto Sans Mono CJK from the offline mirror.
|
||||
[main]
|
||||
font=JetBrains Mono:size=13,WenQuanYi Micro Hei Mono:size=13
|
||||
font=Noto Sans Mono CJK SC:size=13
|
||||
|
||||
[colors-dark]
|
||||
background=1a1b26
|
||||
|
||||
Reference in new issue
Block a user