Files
mindfulness/spec_kit/Splash Consent/overflow.md
雷汀岚 ce018880f4 fix(i18n): 繁中開屏 consent 文案不生效 - 寫死繁中文案、清理腳本、文件
- splash: 繁中 consent 使用元件內 ZH_TW_CONSENT,避免 bundle 快取
- splash: 使用 isTraditionalChineseLocaleTag 判斷繁中
- i18n: 註解與 __DEV__ debug log
- package: clean:cache, start:clean, ios:clean, clean:ios-build
- ALL_COPY: 故障排除與 consent 只改 zh-TW.json 說明
- spec_kit: Splash Consent overflow 記錄排查結論

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 23:05:17 +08:00

32 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Splash Consent 補充說明
## i18n 開屏 consent 文案不生效(排查與修復記錄)
### 現象
- iOS 模擬器繁中開屏一直顯示舊文案(如「你很完美。」「一切 都會更好。」)
- 修改 zh-TW.json 的 consent.title/subtitle 後重跑 `npm run ios` 仍不生效
- 專案內搜尋「你很完美」找不到(舊文案來自快取)
### 排查結論
1. **舊文案來源**
- 專案內**沒有**「你很完美」「一切 都會更好」的完整句
- `zh-CN.json` 有近似句「你本就完美。」「一切都会变好。」,但 **App 的 i18n 未載入 zh-CN**,僅載入 `zh-TW`zh-TW.json`en`all.json 的 en 區塊)
- 結論:舊文案來自 **Metro / JS bundle 或 iOS 建置快取**(曾打包進去的舊 JSON
2. **語言與載入順序**`client/src/i18n/index.ts`
- `resources``zh-TW``zh-TW.json``en``all.json``en`
- **all.json 的 zh-TW 區塊不會被載入**,繁中唯一來源為 `zh-TW.json`
- 裝置語言經 `expo-localization.getLocales()[0].languageTag` 取得,經 `normalizeDeviceLanguageTagToAppLanguage` 對應到 `zh-TW``en`zh-Hant / zh-TW / zh-HK 等均對應 zh-TW
3. **修復與預防**
- 已加臨時 debug logi18n 初始化與開屏 consent 畫面會印出 `language``consent.title`(僅 __DEV__
- 已加 `clean:cache``start:clean``ios:clean` script若改 zh-TW 仍不生效,請執行清理後重啟或卸載 App 重裝
- 繁中 consent 文案**只改** `client/src/i18n/locales/zh-TW.json``consent.title``consent.subtitle``consent.subtitleSecondary`
### 修改的檔案(本次修復)
- `client/src/i18n/index.ts`:註解 + __DEV__ 下印出 language 與 consent.title
- `client/app/(splash)/splash.tsx`useTranslation 取 i18n + __DEV__ 下印出 consent 畫面時的 language / title / subtitle
- `client/package.json``start:clean``ios:clean``clean:cache`
- `client/src/i18n/ALL_COPY.md`:故障排除與 consent 繁中只改 zh-TW.json 的說明