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:
94
康康/Security/LockScreenView.swift
Normal file
94
康康/Security/LockScreenView.swift
Normal file
@@ -0,0 +1,94 @@
|
||||
import SwiftUI
|
||||
|
||||
/// 锁屏:全遮罩,onAppear 自动触发一次认证;失败/取消后停留,可点按钮重试。
|
||||
struct LockScreenView: View {
|
||||
@State private var appLock = AppLock.shared
|
||||
|
||||
/// 认证按钮 / 图标随设备能力变化。
|
||||
private var glyph: String {
|
||||
switch appLock.biometryLabel {
|
||||
case "Face ID": return "faceid"
|
||||
case "Touch ID": return "touchid"
|
||||
default: return "lock.fill"
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Tj.Palette.sand.ignoresSafeArea()
|
||||
|
||||
VStack(spacing: 18) {
|
||||
Spacer()
|
||||
|
||||
ZStack {
|
||||
Circle()
|
||||
.fill(Tj.Palette.paper)
|
||||
.overlay(Circle().strokeBorder(Tj.Palette.line, lineWidth: 1))
|
||||
Image(systemName: "lock.fill")
|
||||
.font(.system(size: 34))
|
||||
.foregroundStyle(Tj.Palette.ink)
|
||||
}
|
||||
.frame(width: 92, height: 92)
|
||||
.shadow(color: Tj.Palette.ink.opacity(0.06), radius: 12, y: 4)
|
||||
|
||||
VStack(spacing: 6) {
|
||||
Text("康康 已锁定")
|
||||
.font(.tjH2())
|
||||
.foregroundStyle(Tj.Palette.text)
|
||||
Text("你的健康档案已加密保护")
|
||||
.font(.system(size: 13))
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
Task { await appLock.authenticate() }
|
||||
} label: {
|
||||
Label("\(appLock.biometryLabel) 解锁", systemImage: glyph)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(TjPrimaryButton(height: 52, fontSize: 16))
|
||||
.padding(.horizontal, 40)
|
||||
.padding(.bottom, 48)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
Task { await appLock.authenticate() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 隐私遮罩:进任务切换器 / 后台时盖在内容之上,挡住多任务快照里的健康数据。
|
||||
/// 无交互,纯品牌底。
|
||||
struct PrivacyCoverView: View {
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Tj.Palette.sand.ignoresSafeArea()
|
||||
|
||||
VStack(spacing: 14) {
|
||||
ZStack {
|
||||
Circle()
|
||||
.fill(Tj.Palette.paper)
|
||||
.overlay(Circle().strokeBorder(Tj.Palette.line, lineWidth: 1))
|
||||
Image(systemName: "heart.text.square.fill")
|
||||
.font(.system(size: 30))
|
||||
.foregroundStyle(Tj.Palette.ink)
|
||||
}
|
||||
.frame(width: 80, height: 80)
|
||||
|
||||
Text("康康")
|
||||
.font(.tjH2())
|
||||
.foregroundStyle(Tj.Palette.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview("锁屏") {
|
||||
LockScreenView()
|
||||
}
|
||||
|
||||
#Preview("隐私遮罩") {
|
||||
PrivacyCoverView()
|
||||
}
|
||||
Reference in New Issue
Block a user