主体:多语言支持(简体中文源 + 英/日/韩)
- 基础设施: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>
68 lines
2.4 KiB
Swift
68 lines
2.4 KiB
Swift
import SwiftUI
|
|
|
|
struct TimelineRow: View {
|
|
let entry: TimelineEntry
|
|
|
|
var body: some View {
|
|
HStack(spacing: 12) {
|
|
ZStack {
|
|
RoundedRectangle(cornerRadius: 8, style: .continuous)
|
|
.fill(entry.kind.accent.opacity(0.12))
|
|
Image(systemName: entry.kind.icon)
|
|
.font(.system(size: 14, weight: .semibold))
|
|
.foregroundStyle(entry.kind.accent)
|
|
}
|
|
.frame(width: 36, height: 36)
|
|
.overlay(alignment: .topTrailing) {
|
|
if entry.isOngoing {
|
|
Circle()
|
|
.fill(Tj.Palette.brick)
|
|
.frame(width: 7, height: 7)
|
|
.overlay(Circle().strokeBorder(Tj.Palette.sand, lineWidth: 1.5))
|
|
.offset(x: 3, y: -3)
|
|
}
|
|
}
|
|
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
Text("\(entry.date.timelineLabel) · \(entry.subtitle)")
|
|
.font(.system(size: 11))
|
|
.tracking(0.3)
|
|
.foregroundStyle(Tj.Palette.text3)
|
|
.lineLimit(1)
|
|
Text(entry.title)
|
|
.font(.system(size: 14, weight: .medium))
|
|
.foregroundStyle(Tj.Palette.text)
|
|
.lineLimit(1)
|
|
.truncationMode(.tail)
|
|
}
|
|
Spacer(minLength: 8)
|
|
if let trailing = entry.trailing {
|
|
Text(trailing)
|
|
.font(.system(size: 12, weight: .semibold, design: .monospaced))
|
|
.foregroundStyle(entry.trailingIsAlert ? Tj.Palette.brick : Tj.Palette.text2)
|
|
.lineLimit(1)
|
|
.fixedSize()
|
|
}
|
|
}
|
|
.padding(12)
|
|
.tjCard(bordered: true)
|
|
}
|
|
}
|
|
|
|
extension Date {
|
|
var timelineLabel: String {
|
|
let cal = Calendar.current
|
|
if cal.isDateInToday(self) {
|
|
return self.formatted(date: .omitted, time: .shortened)
|
|
}
|
|
if cal.isDateInYesterday(self) {
|
|
return String(appLoc: "昨天") + " " + self.formatted(date: .omitted, time: .shortened)
|
|
}
|
|
let now = Date.now
|
|
if cal.isDate(self, equalTo: now, toGranularity: .year) {
|
|
return self.formatted(.dateTime.month().day())
|
|
}
|
|
return self.formatted(.dateTime.year().month().day())
|
|
}
|
|
}
|