feat: 国际化(i18n) en/ja/ko + App 内语言切换

主体:多语言支持(简体中文源 + 英/日/韩)
- 基础设施:Localizable.xcstrings(String Catalog,sourceLanguage=zh-Hans)
  + pbxproj developmentRegion/knownRegions 注册 en/ja/ko
- 全部硬编码 Locale("zh_CN") → Locale.current;中文 dateFormat → Date.FormatStyle(跟随系统)
- UI 中文字面量统一为 String(appLoc:)(显式绑定所选语言 bundle+locale,即时切换)
  Text 字面量走环境 \.locale + Bundle 重定向
- 549 个 catalog key 全部 en/ja/ko 翻译完成(0 未翻译)
- App 内语言切换:我的 → 语言(LanguageManager + 即时生效,无需重启)
- 双用预设(症状/监测指标/慢病)本地化:static→computed 避免缓存

注:本提交为 WIP,一并打包了并行进行的功能模块
(HealthExport 健康导出、Security/Face ID 锁、DiaryAssist 日记 AI 辅助)
及 App 图标、CLAUDE.md、docs/scripts。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
link2026
2026-05-30 10:28:24 +08:00
parent 910ca99f21
commit d2c77d5c51
84 changed files with 15643 additions and 699 deletions

View File

@@ -17,11 +17,11 @@ struct B5ResultView: View {
@State private var normalsExpanded = false
let abnormal: [B5IndicatorData] = [
.init(name: "低密度脂蛋白胆固醇", value: "3.84", unit: "mmol/L", range: "< 3.40", status: .high,
note: "超过参考上限 0.44。建议关注饮食结构3 个月内复查。"),
.init(name: "甘油三酯 TG", value: "1.78", unit: "mmol/L", range: "0.451.70", status: .high, note: nil),
.init(name: "尿酸 UA", value: "428", unit: "μmol/L", range: "150420", status: .high, note: nil),
.init(name: "维生素 D", value: "18", unit: "ng/mL", range: "30100", status: .low, note: nil),
.init(name: String(appLoc: "低密度脂蛋白胆固醇"), value: "3.84", unit: "mmol/L", range: "< 3.40", status: .high,
note: String(appLoc: "超过参考上限 0.44。建议关注饮食结构3 个月内复查。")),
.init(name: String(appLoc: "甘油三酯 TG"), value: "1.78", unit: "mmol/L", range: "0.451.70", status: .high, note: nil),
.init(name: String(appLoc: "尿酸 UA"), value: "428", unit: "μmol/L", range: "150420", status: .high, note: nil),
.init(name: String(appLoc: "维生素 D"), value: "18", unit: "ng/mL", range: "30100", status: .low, note: nil),
]
let normalCount = 24
@@ -33,7 +33,7 @@ struct B5ResultView: View {
VStack(alignment: .leading, spacing: 0) {
reportMeta.padding(.bottom, 16)
summaryCard.padding(.bottom, 18)
SectionLabel("异常项", count: abnormal.count, accent: .brick)
SectionLabel(String(appLoc: "异常项"), count: abnormal.count, accent: .brick)
.padding(.bottom, 10)
VStack(spacing: 8) {
ForEach(Array(abnormal.enumerated()), id: \.offset) { idx, it in
@@ -44,7 +44,7 @@ struct B5ResultView: View {
}
.padding(.bottom, 18)
SectionLabel("正常项", count: normalCount, accent: .leaf)
SectionLabel(String(appLoc: "正常项"), count: normalCount, accent: .leaf)
.padding(.bottom, 10)
normalCollapsed
}
@@ -97,7 +97,7 @@ struct B5ResultView: View {
private var reportMeta: some View {
VStack(alignment: .leading, spacing: 6) {
HStack(spacing: 8) {
TjBadge(text: "体检报告", style: .ink)
TjBadge(text: String(appLoc: "体检报告"), style: .ink)
Text("3 页")
.font(.system(size: 11))
.foregroundStyle(Tj.Palette.text3)
@@ -130,10 +130,10 @@ struct B5ResultView: View {
.padding(.bottom, 12)
HStack(spacing: 14) {
Stat(n: "28", label: "总项")
Stat(n: "3", label: "偏高", tone: .brick)
Stat(n: "1", label: "偏低", tone: .amber)
Stat(n: "24", label: "正常", tone: .leaf)
Stat(n: "28", label: String(appLoc: "总项"))
Stat(n: "3", label: String(appLoc: "偏高"), tone: .brick)
Stat(n: "1", label: String(appLoc: "偏低"), tone: .amber)
Stat(n: "24", label: String(appLoc: "正常"), tone: .leaf)
}
.padding(.bottom, 14)
@@ -253,9 +253,9 @@ private struct IndicatorRow: View {
}
var statusWord: String {
switch item.status {
case .high: return "偏高"
case .low: return "偏低"
case .normal: return "正常"
case .high: return String(appLoc: "偏高")
case .low: return String(appLoc: "偏低")
case .normal: return String(appLoc: "正常")
}
}
var valueColor: Color {