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

2.0 KiB
Raw Blame History

Splash Consent 補充說明

現象

  • iOS 模擬器繁中開屏一直顯示舊文案(如「你很完美。」「一切 都會更好。」)
  • 修改 zh-TW.json 的 consent.title/subtitle 後重跑 npm run ios 仍不生效
  • 專案內搜尋「你很完美」找不到(舊文案來自快取)

排查結論

  1. 舊文案來源

    • 專案內沒有「你很完美」「一切 都會更好」的完整句
    • zh-CN.json 有近似句「你本就完美。」「一切都会变好。」,但 App 的 i18n 未載入 zh-CN,僅載入 zh-TWzh-TW.jsonenall.json 的 en 區塊)
    • 結論:舊文案來自 Metro / JS bundle 或 iOS 建置快取(曾打包進去的舊 JSON
  2. 語言與載入順序client/src/i18n/index.ts

    • resourceszh-TWzh-TW.jsonenall.jsonen
    • all.json 的 zh-TW 區塊不會被載入,繁中唯一來源為 zh-TW.json
    • 裝置語言經 expo-localization.getLocales()[0].languageTag 取得,經 normalizeDeviceLanguageTagToAppLanguage 對應到 zh-TWenzh-Hant / zh-TW / zh-HK 等均對應 zh-TW
  3. 修復與預防

    • 已加臨時 debug logi18n 初始化與開屏 consent 畫面會印出 languageconsent.title(僅 DEV
    • 已加 clean:cachestart:cleanios:clean script若改 zh-TW 仍不生效,請執行清理後重啟或卸載 App 重裝
    • 繁中 consent 文案只改 client/src/i18n/locales/zh-TW.jsonconsent.titleconsent.subtitleconsent.subtitleSecondary

修改的檔案(本次修復)

  • client/src/i18n/index.ts:註解 + DEV 下印出 language 與 consent.title
  • client/app/(splash)/splash.tsxuseTranslation 取 i18n + DEV 下印出 consent 畫面時的 language / title / subtitle
  • client/package.jsonstart:cleanios:cleanclean:cache
  • client/src/i18n/ALL_COPY.md:故障排除與 consent 繁中只改 zh-TW.json 的說明