Ask for the language, not the region, on the installer's first screen
omarchy_prompt_keyboard takes the layout to preselect.
This commit is contained in:
1 parent
848e9610c0
commit
e5b01ace6b
2 files changed
+47
-41
No files matched your search
@@ -129,28 +129,29 @@ omarchy_username_taken() { return 1; }
|
||||
# by `status=$?`: one caller runs under `set -e`, where a cancelled prompt is a
|
||||
# failing assignment that would kill the script before the status is read.
|
||||
|
||||
# China lists the .cn mirrors first and sets up Chinese input; its Chinese name shows only in a CJK console.
|
||||
omarchy_prompt_region() {
|
||||
local china="China" header="Select region" selected=Global choice status
|
||||
# English or Simplified Chinese; the Chinese name shows only in a CJK console.
|
||||
omarchy_prompt_language() {
|
||||
local chinese="Chinese" header="Select language" selected=English choice status
|
||||
if [[ -n ${OMARCHY_CJK_CONSOLE:-} ]]; then
|
||||
china="China 中国"
|
||||
header="Select region · 选择区域"
|
||||
chinese="简体中文 Chinese"
|
||||
header="Select language · 选择语言"
|
||||
fi
|
||||
[[ $region == "cn" ]] && selected=$china
|
||||
choice=$(printf '%s\n' Global "$china" | gum choose --selected "$selected" --header "$header") && status=0 || status=$?
|
||||
[[ $language == "zh" ]] && selected=$chinese
|
||||
choice=$(printf '%s\n' English "$chinese" | gum choose --selected "$selected" --header "$header") && status=0 || status=$?
|
||||
((status == 0)) || return $status
|
||||
|
||||
if [[ $choice == "Global" ]]; then
|
||||
region=global
|
||||
if [[ $choice == "English" ]]; then
|
||||
language=en
|
||||
else
|
||||
region=cn
|
||||
language=zh
|
||||
fi
|
||||
}
|
||||
|
||||
# Callers may name the layout to preselect.
|
||||
omarchy_prompt_keyboard() {
|
||||
local choice status
|
||||
local choice status selected=${1:-English (US)}
|
||||
choice=$(printf '%s\n' "$OMARCHY_KEYBOARD_LAYOUTS" | cut -d'|' -f1 |
|
||||
gum choose --height 10 --selected "English (US)" --header "$(omarchy_text "Select keyboard layout")") && status=0 || status=$?
|
||||
gum choose --height 10 --selected "$selected" --header "$(omarchy_text "Select keyboard layout")") && status=0 || status=$?
|
||||
((status == 0)) || return $status
|
||||
|
||||
local selection
|
||||
|
||||
Reference in new issue
Block a user