Repository navigation
feat(i18n): ship the platform's 11 language tags, resolved by script - #189
Open
objectstack-fleet[bot] wants to merge 2 commits into
Open
objectstack-fleet[bot] wants to merge 2 commits into
objectstack-fleet[bot] wants to merge 2 commits into
Conversation
Rename zh -> zh-Hans and pt -> pt-BR, add a zh-Hant bundle converted from zh-Hans (opencc-js s2twp with the www.objectos.ai phrase overrides), and replace the Console's exact-then-base matcher with resolveLanguageTag: Hant/Hans script first, TW/HK/MO -> zh-Hant, other zh -> zh-Hans, pt-* -> pt-BR, else the primary subtag. zh-Hant gets its own iOS permission text. Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv Co-authored-by: Claude <noreply@anthropic.com>
HYBRID-SHELL and connection-flow say 11 and name the table; the device check and the contributing note stop naming zh.json and stop saying zh-TW shows Simplified Chinese. Changeset for the locale move. Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
repo:mobile#1 · os-justin · session_01QSeKYnW1Xf6HDSWz1eGAqv Seat verdict: ACCEPT, maintainer merges. Seat landing is suspended because 维护者速读
席位核对
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #182
Clause-②: no
Metadata-protocol: none
维护者速读
zh改名zh-Hans、pt改名pt-BR,iOS 相机/相册/面容 ID 权限弹窗的繁体也有了自己的文案。lib/i18n.ts的resolveLanguageTag(脚本优先于地区的判定)、locales/zh-Hant.json(机器转换文本)、app.config.ts的PERMISSION_LOCALES(葡语写成不带地区的pt)。npx jest --ci __tests__/lib/i18n.test.ts,预期Tests: 90 passed, 90 total。What changes
The shell's native strings move from the Console's ten short codes to the platform's one list of 11 tags (objectstack-ai/objectstack#29428, ruling F of #29349):
en zh-Hans zh-Hant es ar fr pt-BR ru de ja ko, in the table's order.locales/zh.json→zh-Hans.jsonandlocales/pt.json→pt-BR.json, both pure renames (git similarity 100%). Newlocales/zh-Hant.json, converted fromzh-Hans.json(see Acceptance notes for the recipe). Every key onmaincarries over to all 11, and the key-parity test now covers all 11.matchLanguageTag, the port of the Console's exact-then-base rule that collapsed both scripts tozh, is removed (nothing else imported it).resolveLanguageTag(tag)replaces it.app.config.tsPERMISSION_LOCALESgiveszh-Hant.lprojthezh-Hantbundle's camera, photo-library and Face ID text instead of the Simplified text. Portuguese stays written as the unqualifiedptlproj, now holding thept-BRtext, so every Portuguese variant falls back to it on iOS, matching the shell'spt-*→pt-BRrule.languageTag.detectDeviceLanguagebuilds the tag fromlanguageCode+languageScriptCode+regionCode, so the script is not lost (zh+Hant+TW→zh-Hant-TW).docs/HYBRID-SHELL.md(Language, the camera-permission paragraph, the file map) anddocs/design/connection-flow.md(Languages and layout) say 11 and name the table.The contract of
resolveLanguageTag(tag): SupportedLanguage | nullOne BCP 47 tag in, one bundled language or
nullout. Subtags compare case-insensitively. Only the language, script and region subtags are read, and scanning stops at the first singleton (-u-,-x-), so an extension value never reads as a region.zhwith scriptHant(zh-Hant,zh-Hant-TW,zh-Hant-CN)zh-Hantzhwith scriptHans(zh-Hans,zh-Hans-CN,zh-Hans-HK)zh-Hanszhwith no script and regionTW,HKorMOzh-Hantzh(zh,zh-CN,zh-SG)zh-Hanspt(pt,pt-PT,pt-BR,pt-AO)pt-BRen-US,es-MX)it-IT,yue-HK, empty)nullresolveLanguage/detectDeviceLanguagewalk the phone's preferred languages in order, return the first non-null result, and otherwise returnen.Tests
All three CI families were run locally at
a4a903a; their commands are the same asci.ymlandlint-typecheck.yml.npx tsc --noEmit: exit 0.--listFilesincludeslib/i18n.ts,app.config.ts,locales/zh-Hant.jsonand both changed__tests__/libfiles.npx eslint . --ext .ts,.tsx: exit 0, no output.npx jest --ci --coverage: exit 0,Test Suites: 49 passed, 49 total,Tests: 1070 passed, 1070 total;lib/i18n.ts92.06% statements.New or changed pins in
__tests__/lib/i18n.test.ts:zh-Hans-CN/zh-CN/zh-SG→zh-Hans,zh-TW/zh-HK/zh-Hant→zh-Hant,pt-PT/pt-BR→pt-BR, fall-through to the next preferred language, empty →en;languageTag;zh-Hantandpt-BRbundles.__tests__/lib/app-config.test.tspins that each Chinese script carries its own bundle's text, that the zh-Hant text differs from the zh-Hans text, and that theptlproj carries the pt-BR text.Ablation: map zh-TW to zh-Hans
The implementation was committed first. The mutation went through
scripts/ablation-replace.mjs(objectstack):new Set(["tw", "hk", "mo"])→new Set(["hk", "mo"])inlib/i18n.ts, anchor x1 → x0, blob3da779ed305e→c60ec6d6b0be. Jest reads the source directly; there is nodist/in this repo.The tests went red as expected.
zh-Hant-TWstayed green, correctly, because its script subtag decides before the region is read.Acceptance notes
13b7e32, theorigin/mainat worktree creation, not from427cb49as dispatched.13b7e32contains427cb49, and the five commits in between (feat(eas): link the app to the EAS project so CI can build it #185) touchapp.config.ts, so branching from the newer head avoids a conflict there.zh,zh-CN,zh-SG→zh-Hans;zh-TW,zh-HK,zh-MO→zh-Hant;ja-JP→ja;es-ES→es;pt→pt-BR;en-US→en. The card's rule maps every one of those the same way, and a test pins each. The card's rule also covers inputs that #29428 does not list (pt-PT,zh-Hant-TW,zh-Hans-HK,es-MX). #29428 is silent on those, so they are not conflicts.mainyet. At4b71a82b76,git grep -n PLATFORM_LOCALES origin/main -- packages/spec/src ui/packages/i18n/srcfinds nothing. The control wordBUILT_IN_LANGUAGE_CODEShits inui/packages/i18n/src, so the empty result is not a broken grep. When phase 1 lands, this shell's list and rule should be re-read against the exported table.Accept-Language; see HYBRID-SHELL "Language"), so the tag rename reaches only native screens.objectstack-ai/www.objectos.aiscripts/gen-zh-hant.mjs, was read at4ed1dfethrough git (the REST API refuses that repo in this session). It converts with opencc-js 1.3.1, presets2twp(Simplified to Taiwan, phrase conversion), and itssrc/lib/zhconvert.tsplaces eight phrase overrides at the head of the TWPhrases group: 權限, 實例, 全域, 擴充, 配接器, 控制項, 映像, 腳本. The bundle here was converted with the same version, preset and overrides, values only, keys untouched. A second run reproduceslocales/zh-Hant.jsonbyte for byte. Both locative 里 came out as 裡 (哪裡, 這裡).opencc-jstopackage.jsonand ascripts/file, both outside this card's file surface. So whenzh-Hans.jsonchanges,zh-Hant.jsonis reconverted by the recipe above. HYBRID-SHELL and CONTRIBUTING now say so, and the key-parity test catches a missing key, though not stale text.docs/DEVICE-TESTING.md:78saidzh-TWshows Simplified Chinese. It now carries the 繁體中文 (Taiwan) and Português (Brasil) device check.docs/CONTRIBUTING.md:26namedlocales/{en,zh,ar}.json, andzh.jsonno longer exists.ROADMAP.md:23"i18n (en / zh / ar)" is a historical status line, not a file reference.lockServeris set, the connection switcher shows only the managed connection #187 (MDM lock scope) also editsdocs/HYBRID-SHELL.md, in a different section. Whichever PR lands second reconciles.Verification
a4a903a.Generated by Claude Code