- 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>
2.0 KiB
2.0 KiB
Splash Consent 補充說明
i18n 開屏 consent 文案不生效(排查與修復記錄)
現象
- iOS 模擬器繁中開屏一直顯示舊文案(如「你很完美。」「一切 都會更好。」)
- 修改 zh-TW.json 的 consent.title/subtitle 後重跑
npm run ios仍不生效 - 專案內搜尋「你很完美」找不到(舊文案來自快取)
排查結論
-
舊文案來源
- 專案內沒有「你很完美」「一切 都會更好」的完整句
zh-CN.json有近似句「你本就完美。」「一切都会变好。」,但 App 的 i18n 未載入 zh-CN,僅載入zh-TW(zh-TW.json)與en(all.json 的 en 區塊)- 結論:舊文案來自 Metro / JS bundle 或 iOS 建置快取(曾打包進去的舊 JSON)
-
語言與載入順序(
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)
-
修復與預防
- 已加臨時 debug log:i18n 初始化與開屏 consent 畫面會印出
language與consent.title(僅 DEV) - 已加
clean:cache、start:clean、ios:cleanscript;若改 zh-TW 仍不生效,請執行清理後重啟或卸載 App 重裝 - 繁中 consent 文案只改
client/src/i18n/locales/zh-TW.json的consent.title、consent.subtitle、consent.subtitleSecondary
- 已加臨時 debug log:i18n 初始化與開屏 consent 畫面會印出
修改的檔案(本次修復)
client/src/i18n/index.ts:註解 + DEV 下印出 language 與 consent.titleclient/app/(splash)/splash.tsx:useTranslation 取 i18n + DEV 下印出 consent 畫面時的 language / title / subtitleclient/package.json:start:clean、ios:clean、clean:cacheclient/src/i18n/ALL_COPY.md:故障排除與 consent 繁中只改 zh-TW.json 的說明