Files
kangkang/康康/Features/Archive/B1GuideView.swift
link2026 d2c77d5c51 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>
2026-05-30 10:28:24 +08:00

132 lines
5.0 KiB
Swift

import SwiftUI
struct B1GuideView: View {
var onSingle: () -> Void
var onMulti: () -> Void
var onSkip: () -> Void
var body: some View {
VStack(spacing: 0) {
HStack {
Button(action: onSkip) {
Image(systemName: "xmark")
.font(.system(size: 18, weight: .semibold))
.foregroundStyle(Tj.Palette.text)
.frame(width: 36, height: 36)
}
Spacer()
Button(action: onSkip) {
Text("跳过")
.font(.system(size: 12))
.foregroundStyle(Tj.Palette.text3)
.padding(8)
}
}
.padding(.horizontal, 12)
VStack(alignment: .leading, spacing: 0) {
ZStack {
RoundedRectangle(cornerRadius: Tj.Radius.md, style: .continuous)
.fill(Tj.Palette.ink)
Image(systemName: "doc.text.fill")
.font(.system(size: 26, weight: .medium))
.foregroundStyle(Tj.Palette.paper)
}
.frame(width: 60, height: 60)
.padding(.bottom, 18)
Text("归档一份\n关键报告")
.font(.system(size: 30, weight: .bold))
.lineSpacing(6)
.foregroundStyle(Tj.Palette.text)
.padding(.bottom, 12)
Text("推荐拍清晰的\(Text("整张图").underline()),多页报告可一次完成扫描。原图与解读全部本地加密保存,永不上传。")
.font(.system(size: 13))
.foregroundStyle(Tj.Palette.text2)
.lineSpacing(6)
.padding(.bottom, 26)
VStack(spacing: 12) {
OptCard(title: String(appLoc: "单张报告"), sub: String(appLoc: "一张图,几秒搞定"), hint: String(appLoc: "化验单 · 处方"), badge: nil, action: onSingle)
OptCard(title: String(appLoc: "多页报告"), sub: String(appLoc: "像扫描文档一样翻页拍摄"), hint: String(appLoc: "体检报告 · 影像报告"), badge: String(appLoc: "推荐"), action: onMulti)
}
Spacer(minLength: 18)
HStack(alignment: .top, spacing: 10) {
Image(systemName: "lock.fill")
.font(.system(size: 12))
.foregroundStyle(Tj.Palette.text2)
.padding(.top, 2)
Text("所有照片以 AES 加密存于本机沙盒。康康 服务端无法访问。")
.font(.system(size: 11))
.foregroundStyle(Tj.Palette.text2)
.lineSpacing(4)
.frame(maxWidth: .infinity, alignment: .leading)
}
.padding(12)
.background(
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
.fill(Tj.Palette.sand2)
)
}
.padding(.horizontal, 24)
.padding(.top, 20)
.padding(.bottom, 20)
}
.background(Tj.Palette.sand.ignoresSafeArea())
}
}
private struct OptCard: View {
let title: String
let sub: String
let hint: String
let badge: String?
let action: () -> Void
var body: some View {
Button(action: action) {
HStack(spacing: 14) {
ZStack {
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
.fill(Tj.Palette.sand2)
Image(systemName: "doc.text")
.font(.system(size: 18, weight: .regular))
.foregroundStyle(Tj.Palette.ink)
}
.frame(width: 44, height: 44)
VStack(alignment: .leading, spacing: 3) {
HStack(spacing: 8) {
Text(title)
.font(.system(size: 15, weight: .semibold))
.foregroundStyle(Tj.Palette.text)
if let badge {
TjBadge(text: badge, style: .ink)
}
}
Text("\(sub) · \(hint)")
.font(.system(size: 11))
.foregroundStyle(Tj.Palette.text3)
}
Spacer()
Image(systemName: "chevron.right")
.font(.system(size: 14, weight: .medium))
.foregroundStyle(Tj.Palette.text3)
}
.padding(16)
.tjCard(bordered: true)
}
.buttonStyle(.plain)
}
}
#Preview {
B1GuideView(
onSingle: { print("单张报告") },
onMulti: { print("多页报告") },
onSkip: { print("跳过") }
)
}