Chinese installer onboarding: bilingual setup form, vendored ISO patch

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 01:33:35 -04:00
co-authored by Claude Fable 5
parent 48218b2d5f
commit 84514840f5
3 changed files with 731 additions and 15 deletions
+58 -15
View File
@@ -24,6 +24,49 @@
OMARCHY_FORM_BACK=1
OMARCHY_FORM_SIGNAL=130
# Prompt strings; the ISO's graphical console exports OMARCHY_INSTALL_LANG=zh
if [[ ${OMARCHY_INSTALL_LANG:-} == zh ]]; then
OMARCHY_L_KEYBOARD_HEADER="选择键盘布局"
OMARCHY_L_USERNAME_PROMPT="用户名> "
OMARCHY_L_USERNAME_HINT="仅限字母数字、不含空格(如 dhh)"
OMARCHY_L_USERNAME_RESERVED="该用户名已被系统保留"
OMARCHY_L_USERNAME_TAKEN="该用户名在本机已存在"
OMARCHY_L_USERNAME_INVALID="用户名必须为字母数字且不含空格"
OMARCHY_L_PASSWORD_PROMPT="密码> "
OMARCHY_L_PASSWORD_HINT="用于用户与 root,启用加密时也用于磁盘解锁"
OMARCHY_L_CONFIRM_PROMPT="确认密码> "
OMARCHY_L_CONFIRM_HINT="需与刚输入的密码一致"
OMARCHY_L_PASSWORD_BLANK="密码不能为空!"
OMARCHY_L_PASSWORD_MISMATCH="两次输入的密码不一致!"
OMARCHY_L_FULLNAME_PROMPT="姓名> "
OMARCHY_L_IDENTITY_HINT="用于 git 身份(回车跳过)"
OMARCHY_L_EMAIL_PROMPT="邮箱> "
OMARCHY_L_HOSTNAME_PROMPT="主机名> "
OMARCHY_L_HOSTNAME_HINT="字母、数字与连字符(回车默认 omarchy)"
OMARCHY_L_HOSTNAME_INVALID="主机名须为 1-63 位字母/数字/连字符,且不能以连字符开头或结尾"
OMARCHY_L_TIMEZONE_HEADER="时区"
else
OMARCHY_L_KEYBOARD_HEADER="Select keyboard layout"
OMARCHY_L_USERNAME_PROMPT="Username> "
OMARCHY_L_USERNAME_HINT="Alphanumeric without spaces (like dhh)"
OMARCHY_L_USERNAME_RESERVED="Username is reserved for system"
OMARCHY_L_USERNAME_TAKEN="That username already exists on this machine"
OMARCHY_L_USERNAME_INVALID="Username must be alphanumeric with no spaces"
OMARCHY_L_PASSWORD_PROMPT="Password> "
OMARCHY_L_PASSWORD_HINT="Used for user + root, and disk encryption when enabled"
OMARCHY_L_CONFIRM_PROMPT="Confirm> "
OMARCHY_L_CONFIRM_HINT="Must match the password you just typed"
OMARCHY_L_PASSWORD_BLANK="Your password can'"'"'t be blank!"
OMARCHY_L_PASSWORD_MISMATCH="Passwords didn'"'"'t match!"
OMARCHY_L_FULLNAME_PROMPT="Full name> "
OMARCHY_L_IDENTITY_HINT="Used for git authentication (hit return to skip)"
OMARCHY_L_EMAIL_PROMPT="Email address> "
OMARCHY_L_HOSTNAME_PROMPT="Hostname> "
OMARCHY_L_HOSTNAME_HINT="Letters, digits, and dashes (or return for '"'"'omarchy'"'"')"
OMARCHY_L_HOSTNAME_INVALID="Hostname must be 1-63 letters, digits, or dashes, and cannot start or end with a dash"
OMARCHY_L_TIMEZONE_HEADER="Timezone"
fi
# The English layouts lead, then everything else alphabetically. gum choose
# paginates in --height-sized pages and jumps to the page holding --selected,
# so an alphabetical English (US) landed deep enough to sit alone at the edge
@@ -94,7 +137,7 @@ omarchy_username_taken() { return 1; }
omarchy_prompt_keyboard() {
local choice status
choice=$(printf '%s\n' "$OMARCHY_KEYBOARD_LAYOUTS" | cut -d'|' -f1 |
gum choose --height 10 --selected "English (US)" --header "Select keyboard layout") && status=0 || status=$?
gum choose --height 10 --selected "English (US)" --header "$OMARCHY_L_KEYBOARD_HEADER") && status=0 || status=$?
((status == 0)) || return $status
keyboard_label="$choice"
@@ -104,19 +147,19 @@ omarchy_prompt_keyboard() {
omarchy_prompt_username() {
local status
while true; do
username=$(gum input --placeholder "Alphanumeric without spaces (like dhh)" --prompt.foreground="#845DF9" --prompt "Username> ") && status=0 || status=$?
username=$(gum input --placeholder "$OMARCHY_L_USERNAME_HINT" --prompt.foreground="#845DF9" --prompt "$OMARCHY_L_USERNAME_PROMPT") && status=0 || status=$?
((status == 0)) || return $status
if [[ "$username" =~ $OMARCHY_USERNAME_PATTERN ]]; then
if [[ "$username" =~ $OMARCHY_RESERVED_USERNAMES ]]; then
notice "Username is reserved for system" 1
notice "$OMARCHY_L_USERNAME_RESERVED" 1
elif omarchy_username_taken "$username"; then
notice "That username already exists on this machine" 1
notice "$OMARCHY_L_USERNAME_TAKEN" 1
else
return 0
fi
else
notice "Username must be alphanumeric with no spaces" 1
notice "$OMARCHY_L_USERNAME_INVALID" 1
fi
done
}
@@ -124,17 +167,17 @@ omarchy_prompt_username() {
omarchy_prompt_password() {
local status
while true; do
password=$(gum input --placeholder "Used for user + root, and disk encryption when enabled" --prompt.foreground="#845DF9" --password --prompt "Password> ") && status=0 || status=$?
password=$(gum input --placeholder "$OMARCHY_L_PASSWORD_HINT" --prompt.foreground="#845DF9" --password --prompt "$OMARCHY_L_PASSWORD_PROMPT") && status=0 || status=$?
((status == 0)) || return $status
password_confirmation=$(gum input --placeholder "Must match the password you just typed" --prompt.foreground="#845DF9" --password --prompt "Confirm> ") && status=0 || status=$?
password_confirmation=$(gum input --placeholder "$OMARCHY_L_CONFIRM_HINT" --prompt.foreground="#845DF9" --password --prompt "$OMARCHY_L_CONFIRM_PROMPT") && status=0 || status=$?
((status == 0)) || return $status
if [[ -n "$password" && "$password" == "$password_confirmation" ]]; then
return 0
elif [[ -z "$password" ]]; then
notice "Your password can't be blank!" 1
notice "$OMARCHY_L_PASSWORD_BLANK" 1
else
notice "Passwords didn't match!" 1
notice "$OMARCHY_L_PASSWORD_MISMATCH" 1
fi
done
}
@@ -143,16 +186,16 @@ omarchy_prompt_password() {
# only Esc/Ctrl+C end the prompt early.
omarchy_prompt_identity() {
local status
full_name=$(gum input --placeholder "Used for git authentication (hit return to skip)" --prompt.foreground="#845DF9" --prompt "Full name> ") && status=0 || status=$?
full_name=$(gum input --placeholder "$OMARCHY_L_IDENTITY_HINT" --prompt.foreground="#845DF9" --prompt "$OMARCHY_L_FULLNAME_PROMPT") && status=0 || status=$?
((status == 0)) || return $status
email_address=$(gum input --placeholder "Used for git authentication (hit return to skip)" --prompt.foreground="#845DF9" --prompt "Email address> ") && status=0 || status=$?
email_address=$(gum input --placeholder "$OMARCHY_L_IDENTITY_HINT" --prompt.foreground="#845DF9" --prompt "$OMARCHY_L_EMAIL_PROMPT") && status=0 || status=$?
return $status
}
omarchy_prompt_hostname() {
local status
while true; do
hostname=$(gum input --placeholder "Letters, digits, and dashes (or return for 'omarchy')" --prompt.foreground="#845DF9" --prompt "Hostname> ") && status=0 || status=$?
hostname=$(gum input --placeholder "$OMARCHY_L_HOSTNAME_HINT" --prompt.foreground="#845DF9" --prompt "$OMARCHY_L_HOSTNAME_PROMPT") && status=0 || status=$?
((status == 0)) || return $status
if [[ -z $hostname ]]; then
@@ -161,7 +204,7 @@ omarchy_prompt_hostname() {
elif [[ "$hostname" =~ $OMARCHY_HOSTNAME_PATTERN ]]; then
return 0
else
notice "Hostname must be 1-63 letters, digits, or dashes, and cannot start or end with a dash" 1
notice "$OMARCHY_L_HOSTNAME_INVALID" 1
fi
done
}
@@ -173,9 +216,9 @@ omarchy_prompt_timezone() {
guess=$(tzupdate -p 2>/dev/null) || guess=""
if [[ -n $guess ]]; then
timezone=$(timedatectl list-timezones | gum choose --height 10 --selected "$guess" --header "Timezone") && status=0 || status=$?
timezone=$(timedatectl list-timezones | gum choose --height 10 --selected "$guess" --header "$OMARCHY_L_TIMEZONE_HEADER") && status=0 || status=$?
else
timezone=$(timedatectl list-timezones | gum filter --height 10 --header "Timezone") && status=0 || status=$?
timezone=$(timedatectl list-timezones | gum filter --height 10 --header "$OMARCHY_L_TIMEZONE_HEADER") && status=0 || status=$?
fi
((status == 0)) || return $status