From f5ab724a1c53178b298d7be151a4bdf669b1101b 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, 12 Oct 2026 00:30:55 -0400 Subject: [PATCH] Word Setup > Region and China Apps in Chinese Needs both the Chinese language and the region switch: the Chinese labels for Region and China Apps, the region switch's logout prompt through omarchy-text, and the language half of manual/52-china.md. --- bin/omarchy-region | 4 ++-- default/omarchy/omarchy-menu.zh-cn.jsonc | 11 +++++++++++ manual/02-getting-started.md | 2 +- manual/52-china.md | 21 ++++++++++++++++++--- shell/Commons/I18nZh.js | 2 ++ test/shell.d/menu-locale-test.sh | 2 +- test/shell.d/region-switch-test.sh | 12 ++++++++---- 7 files changed, 43 insertions(+), 11 deletions(-) diff --git a/bin/omarchy-region b/bin/omarchy-region index cc557a47..f01a9f8a 100755 --- a/bin/omarchy-region +++ b/bin/omarchy-region @@ -50,8 +50,8 @@ else fi # The developer mirrors reach only a new session, so offer one. -if [[ -t 0 && -t 1 ]] && gum confirm --affirmative "Log out now" --negative "Later" "Log out now to switch the developer mirrors?"; then +if [[ -t 0 && -t 1 ]] && gum confirm --affirmative "$(omarchy-text "Log out now")" --negative "$(omarchy-text "Later")" "$(omarchy-text "Log out now to switch the developer mirrors?")"; then omarchy-system-logout else - echo "Log back in to switch the developer mirrors." + omarchy-text "Log back in to switch the developer mirrors." fi diff --git a/default/omarchy/omarchy-menu.zh-cn.jsonc b/default/omarchy/omarchy-menu.zh-cn.jsonc index 9bc484b0..a86983ed 100644 --- a/default/omarchy/omarchy-menu.zh-cn.jsonc +++ b/default/omarchy/omarchy-menu.zh-cn.jsonc @@ -189,4 +189,15 @@ "setup.typing": {"label":"输入"}, "setup.typing.keyboard": {"label":"键盘布局"}, "setup.typing.input": {"label":"输入法"}, + "setup.region": {"label":"地区"}, + "setup.region.global": {"label":"全球"}, + "setup.region.china": {"label":"中国"}, + "install.china": {"label":"国内应用"}, + "install.china.wechat": {"label":"微信"}, + "install.china.feishu": {"label":"飞书"}, + "install.china.dingtalk": {"label":"钉钉"}, + "install.china.wemeet": {"label":"腾讯会议"}, + "install.china.tencent-docs": {"label":"腾讯文档"}, + "install.china.yuque": {"label":"语雀"}, + "install.china.shimo": {"label":"石墨文档"}, } diff --git a/manual/02-getting-started.md b/manual/02-getting-started.md index 20cfcc29..9c096c8c 100644 --- a/manual/02-getting-started.md +++ b/manual/02-getting-started.md @@ -22,7 +22,7 @@ The full-disk encryption won't allow you to enter the password from a Bluetooth ### Installing in China -The timezone you pick in the installer decides the region: `Asia/Shanghai` brings Chinese package and developer mirrors and the China apps. See [China](52-china.md). +The installer's first screen asks for your language; pick _Chinese_ for a Chinese installer and system. The timezone you pick later decides the region: `Asia/Shanghai` brings Chinese package and developer mirrors and the China apps. See [China](52-china.md). ### Installing for another owner diff --git a/manual/52-china.md b/manual/52-china.md index 3e00af21..d7f41a51 100644 --- a/manual/52-china.md +++ b/manual/52-china.md @@ -1,6 +1,11 @@ # China -Omarchy works in mainland China without a VPN. The timezone you pick in the installer decides the region: `Asia/Shanghai`, `Asia/Urumqi` and their older names select China; any other timezone is Global. The summary screen shows _Region: cn_ before anything touches the disk. +Omarchy works in mainland China without a VPN. Two installer answers set a machine up for China, and each stands on its own: + +- **Language.** The installer's first screen asks for English or Simplified Chinese. Chinese puts the installer, the system language (`LANG=zh_CN.UTF-8`), the menus and the desktop shell in Chinese. +- **Region.** The timezone you pick decides the region. `Asia/Shanghai`, `Asia/Urumqi` and their older names select China; any other timezone is Global. The summary screen shows _Region: cn_ before anything touches the disk. + +A Chinese speaker abroad keeps the global mirrors, and an English install in Shanghai still gets the China mirrors. ## What the China region sets up @@ -13,6 +18,12 @@ Omarchy works in mainland China without a VPN. The timezone you pick in the inst pacman tries the `.cn` mirror first. If it is unreachable or lacks a package, pacman falls through to `.org`, which works for anyone with their own VPN. The installer carries the China packages on the ISO, so a China install needs no network. +## Chinese input + +After choosing Chinese, the installer's keyboard screen opens on _Chinese (Simplified, Pinyin)_; keep it and Fcitx5 Pinyin is ready at first login. Press `Super + I` to switch to Pinyin, and tap `Shift` to step between Chinese and Latin letters. Add or change an input method later under _Setup > Typing > Input Methods_. See [Keyboard, Mouse, Trackpad](34-keyboard-mouse-trackpad.md). + +Chinese text renders in the right Noto CJK variant everywhere: Simplified for Chinese, Traditional for Taiwan and Hong Kong, Japanese and Korean for those languages. + ## Developer mirrors China machines point the common package managers at mirrors inside China. Environment variables in `/etc/environment.d/90-omarchy-china.conf` cover npm, PyPI and uv, Go, rustup, Bundler and Maven; they reach everything started from the desktop after your next login (not SSH or TTY shells), and they take precedence over npm, pip, uv and Go config files, so unset the variable in a shell to opt out. `/.cargo/config.toml` points crates.io at the mirror unless a project's `.cargo/config.toml` says otherwise, and `/etc/gemrc` sets the RubyGems source unless your `~/.gemrc` sets another. Omarchy never replaces one of those two files if it is a regular file you created. Toolchain downloads by mise, such as Node.js or Go themselves, still come from upstream. @@ -23,6 +34,10 @@ _Install > China Apps_ installs WeChat, QQ, Feishu, DingTalk, Tencent Meeting an ## Switching later -_Setup > Region_, or `omarchy region cn` and `omarchy region global`, switches the region. China runs a full system update, trusts the ArchLinuxCN keyring, records the region, moves pacman to the `.cn` mirrors and links the developer mirrors. Global moves pacman back to `.org`, removes the developer mirrors and hides _Install > China Apps_; apps you installed from it stay. The developer mirrors change at the next login, so the switch offers to log out. `omarchy update` never changes the region. +_Setup > Region_, or `omarchy region cn` and `omarchy region global`, switches the region. China runs a full system update, trusts the ArchLinuxCN keyring, records the region, moves pacman to the `.cn` mirrors and links the developer mirrors. Global moves pacman back to `.org`, removes the developer mirrors and hides _Install > China Apps_; apps you installed from it stay. The developer mirrors change at the next login, so the switch offers to log out. -A machine prepared for another owner installs Global, since its timezone is only set on first boot. Switch it under _Setup > Region_ once it is online. +_Setup > Language_, or `omarchy language zh` and `omarchy language en`, switches the system language. The menus and the desktop shell follow at the next login, so it offers to log out too. + +Neither switch touches the other, the input methods or the CJK fonts. `omarchy update` never changes the region or the language. + +A machine prepared for another owner keeps the language picked in the installer but installs Global, since its timezone is only set on first boot. Switch it under _Setup > Region_ once it is online. diff --git a/shell/Commons/I18nZh.js b/shell/Commons/I18nZh.js index b05bbbf6..5c13a4e0 100644 --- a/shell/Commons/I18nZh.js +++ b/shell/Commons/I18nZh.js @@ -634,6 +634,8 @@ var table = { "Later": "稍后", "Log out now to switch the language?": "立即注销以切换语言?", "Log back in to switch the language.": "重新登录后切换语言。", + "Log out now to switch the developer mirrors?": "立即注销以切换开发工具镜像?", + "Log back in to switch the developer mirrors.": "重新登录后切换开发工具镜像。", "Superwhisper Dictation Ready": "Superwhisper 语音输入就绪", "Hold Right Alt or F9 to dictate (or toggle with Super + Ctrl + X).": "按住右 Alt 或 F9 说话(或用 Super + Ctrl + X 切换)。", "Background Intros": "背景开场动画", diff --git a/test/shell.d/menu-locale-test.sh b/test/shell.d/menu-locale-test.sh index 0b63ea31..fd1ef917 100755 --- a/test/shell.d/menu-locale-test.sh +++ b/test/shell.d/menu-locale-test.sh @@ -34,7 +34,7 @@ for (const item of defaults) { if (item.id !== 'system.lock' && zh && zh.declared.includes('label') && result.label !== zh.label) fail(`${item.id} shows its Chinese label`) } if (merged['system.lock'].label !== 'Mine') fail('a user extension still overrides the Chinese label') -if (merged['system.reboot'].label !== '重启' || merged['setup.language'].label !== '语言') fail('Chinese labels reach the merged menu') +if (merged['system.reboot'].label !== '重启' || merged['setup.language'].label !== '语言' || merged['install.china.wechat'].label !== '微信') fail('Chinese labels reach the merged menu') console.log('ok - Chinese labels replace only the label, and user extensions still win') JS diff --git a/test/shell.d/region-switch-test.sh b/test/shell.d/region-switch-test.sh index 64fd9786..73f436b8 100644 --- a/test/shell.d/region-switch-test.sh +++ b/test/shell.d/region-switch-test.sh @@ -10,6 +10,7 @@ trap 'rm -rf "$test_tmp"' EXIT root="$test_tmp/root" sandbox="$test_tmp/omarchy" calls="$test_tmp/calls" mkdir -p "$root/etc/pacman.d" "$sandbox/bin" "$sandbox/install/config" "$sandbox/default/regions" "$test_tmp/bin" "$test_tmp/home" cp -r "$ROOT/default/regions/cn" "$sandbox/default/regions/" +mkdir -p "$sandbox/shell/Commons" && cp "$ROOT/shell/Commons/I18nZh.js" "$sandbox/shell/Commons/" rewrite() { sed -e "s|/etc/|$root/etc/|g" -e "s| /\\.cargo/| $root/.cargo/|g" "$1" >"$2"; chmod +x "$2"; } rewrite "$ROOT/install/config/region.sh" "$sandbox/install/config/region.sh" rewrite "$ROOT/bin/omarchy-region" "$sandbox/bin/omarchy-region" @@ -22,6 +23,7 @@ printf '#!/bin/bash\necho "${STUB_CHANNEL:-stable}"\n' >"$test_tmp/bin/omarchy-v printf '#!/bin/bash\n[[ $1 == env ]] && shift\nexec env "$@"\n' >"$test_tmp/bin/sudo" printf '#!/bin/bash\necho "gum $*" >>"%s"\nexit "${GUM_ANSWER:-1}"\n' "$calls" >"$test_tmp/bin/gum" chmod +x "$test_tmp/bin"/* +ln -s "$ROOT/bin/omarchy-text" "$test_tmp/bin/omarchy-text" mkdir -p "$test_tmp/tmp" export PATH="$test_tmp/bin:$sandbox/bin:$PATH" OMARCHY_PATH="$sandbox" HOME="$test_tmp/home" TMPDIR="$test_tmp/tmp" switch_calls() { sed "s|$test_tmp/tmp/[^/ ]*|RENDERED|g" "$calls"; } @@ -66,11 +68,13 @@ pass "a failed switch to China leaves the machine Global" grep -q '^gum' "$calls" && fail "a switch without a terminal asks nothing" "$(<"$calls")" : >"$calls" -output=$(GUM_ANSWER=1 script -qec "omarchy-region cn" /dev/null) -[[ $output == *"Log back in to switch the developer mirrors."* ]] && ! grep -q '^omarchy-system-logout' "$calls" || +output=$(LANG=zh_CN.UTF-8 GUM_ANSWER=1 script -qec "omarchy-region cn" /dev/null) +grep -qxF 'gum confirm --affirmative 立即注销 --negative 稍后 立即注销以切换开发工具镜像?' "$calls" || + fail "a Chinese session offers to log out in Chinese" "$(<"$calls")" +[[ $output == *"重新登录后切换开发工具镜像。"* ]] && ! grep -q '^omarchy-system-logout' "$calls" || fail "declining the logout leaves a reminder and the session" "$output" : >"$calls" -GUM_ANSWER=0 script -qec "omarchy-region global" /dev/null >/dev/null +LANG=en_US.UTF-8 GUM_ANSWER=0 script -qec "omarchy-region global" /dev/null >/dev/null grep -qxF 'gum confirm --affirmative Log out now --negative Later Log out now to switch the developer mirrors?' "$calls" && grep -qx 'omarchy-system-logout ' "$calls" || fail "a terminal switch offers to log out and logs out on yes" "$(<"$calls")" -pass "a switch in a terminal offers to log out" +pass "a switch in a terminal offers to log out in the session's language"