fix(ui): 校正三语指标文案并核对构建包译文

This commit is contained in:
2026-11-16 00:17:42 +08:00
parent 3ee6b45eb4
commit 36518d29db
10 changed files with 172 additions and 38 deletions
@@ -48,7 +48,8 @@ extension MenuPanelView {
return ResourceCard(
title: "metric.gpu", symbol: "square.grid.2x2", color: Color("MetricGPU"), value: MetricFormat.percent(snapshot.gpuUsage),
titleBadge: snapshot.gpu?.coreCount.map {
String(format: AppLocalization.string("gpu.coreCountFormat", locale: locale), $0)
$0 == 1 ? AppLocalization.string("gpu.oneCore", locale: locale)
: String(format: AppLocalization.string("gpu.coreCountFormat", locale: locale), $0)
},
status: snapshot.gpuTemperature.map { "\(Int($0.rounded()))°C" },
chartPlacement: .background,
@@ -110,7 +111,7 @@ extension MenuPanelView {
second: samples.map(\.memoryApp), third: samples.map(\.memoryWired), fourth: samples.map(\.memoryCompressed),
color: Color("MemoryApplication"), secondColor: Color("MemoryApplication"),
thirdColor: Color("MemoryWired"), fourthColor: Color("MemoryCompressed"), fixedScale: Double(snapshot.memory?.total ?? 1),
firstValueFormat: .memory, firstLabel: "gpu.totalUtilization",
firstValueFormat: .memory, firstLabel: "memory.used",
secondLabel: "memory.app", thirdLabel: "memory.wired", fourthLabel: "memory.compressed",
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals, stackOrder: [1, 2, 3])
}
+2 -1
View File
@@ -162,7 +162,8 @@ struct MenuPanelView: View {
HStack {
HStack(spacing: 4) {
Text("panel.uptime")
MetricText(value: String(format: "%.1f h", snapshot.uptime / 3600))
let hours = (snapshot.uptime / 3600).formatted(.number.precision(.fractionLength(1)).grouping(.never).locale(locale))
Text("duration.hours \(hours)").monospacedDigit()
}.fixedSize()
Divider().frame(height: 14)
Text(verbatim: HardwareIdentity.displayName)
@@ -105,10 +105,10 @@ struct PowerResourceCard: View {
InlineMetric("battery.cyclesShort", battery.cycles.map(String.init) ?? "--")
}
HStack(spacing: 4) {
Text("battery.timeShort").foregroundStyle(.secondary)
Text(battery.flow.charging == true ? "battery.timeToFull" : "battery.timeShort").foregroundStyle(.secondary)
if let minutes = battery.minutesRemaining {
MetricText(value: "\(minutes) min")
} else if battery.flow.state == .external {
Text("duration.minutes \(minutes)").monospacedDigit()
} else if battery.flow.state == .external && battery.flow.charging != true {
Text("battery.notApplicableShort").help(Text("battery.timeNotApplicable"))
} else {
Text("battery.timeUnknown")
+10 -7
View File
@@ -7,7 +7,7 @@ struct StorageDetailsView: View {
var body: some View {
VStack(alignment: .leading, spacing: 3) {
field("memory.available", value: MetricFormat.bytes(disk?.available))
field("memory.available", value: Text(verbatim: MetricFormat.bytes(disk?.available)))
ViewThatFits(in: .horizontal) {
HStack(spacing: 6) { read; write }.fixedSize(horizontal: true, vertical: true)
VStack(alignment: .leading, spacing: 3) { read; write }
@@ -24,15 +24,18 @@ struct StorageDetailsView: View {
.font(.system(size: 10)).lineLimit(1)
}
private var read: some View { field("disk.read", value: MetricFormat.rate(io?.read)) }
private var write: some View { field("disk.write", value: MetricFormat.rate(io?.written)) }
private var life: some View { field("disk.lifeShort", value: MetricFormat.percent(health?.remainingLife)) }
private var powerOn: some View { field("disk.powerOnShort", value: health?.powerOnHours.map { "\($0) h" } ?? "--") }
private var read: some View { field("disk.read", value: Text(verbatim: MetricFormat.rate(io?.read))) }
private var write: some View { field("disk.write", value: Text(verbatim: MetricFormat.rate(io?.written))) }
private var life: some View { field("disk.lifeShort", value: Text(verbatim: MetricFormat.percent(health?.remainingLife))) }
private var powerOn: some View {
let hours = health?.powerOnHours.map { Text("duration.hours \(String($0))") }
return field("disk.powerOnShort", value: hours ?? Text(verbatim: "--"))
}
private func field(_ title: LocalizedStringKey, value: String) -> some View {
private func field(_ title: LocalizedStringKey, value: Text) -> some View {
HStack(spacing: 3) {
Text(title).foregroundStyle(.secondary).help(Text(title))
MetricText(value: value).fontWeight(.medium).foregroundStyle(.primary)
value.monospacedDigit().fontWeight(.medium).foregroundStyle(.primary)
}.frame(height: 14)
}
}
+128 -18
View File
@@ -1,6 +1,94 @@
{
"sourceLanguage" : "en",
"strings" : {
"duration.hours %@": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "%@ h"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "%@ 小时"
}
},
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "%@ 小時"
}
}
}
},
"duration.minutes %lld": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "%lld min"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "%lld 分钟"
}
},
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "%lld 分鐘"
}
}
}
},
"memory.used": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Memory used"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "已用内存"
}
},
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "已用記憶體"
}
}
}
},
"gpu.oneCore": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "1 core"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "1 核"
}
},
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "1 核心"
}
}
}
},
"power.charging": {
"localizations": {
"en": {
@@ -238,7 +326,7 @@
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "應用包含應用和系統程序使用的匿名記憶體;連動包含核心、驅動等常駐記憶體;壓縮為壓縮器的實際實體佔用。可回收快取計入可用空間,磁碟 Swap 不再疊加到實體記憶體已用量。"
"value": "App 記憶體包含 App 與系統程序使用的匿名記憶體。系統核心記憶體包含核心與驅動程式等必須常駐的記憶體。壓縮欄顯示壓縮後實際佔用的實體記憶體。可回收的快取計入可用記憶體,磁碟上的交換空間另計。"
}
}
}
@@ -270,7 +358,7 @@
"en": {
"stringUnit": {
"state": "translated",
"value": "On-time"
"value": "Power-on"
}
},
"zh-Hans": {
@@ -336,19 +424,41 @@
"en": {
"stringUnit": {
"state": "translated",
"value": "Time"
"value": "Time left"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "估时"
"value": "剩余时间"
}
},
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "估時"
"value": "剩餘時間"
}
}
}
},
"battery.timeToFull" : {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Time to full"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "距充满"
}
},
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "距充滿"
}
}
}
@@ -392,7 +502,7 @@
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "應用"
"value": "App"
}
}
}
@@ -414,7 +524,7 @@
"zh-Hant": {
"stringUnit": {
"state": "translated",
"value": "連動"
"value": "系統核心"
}
}
}
@@ -1678,19 +1788,19 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Measured intervals / enumerated processes: %1$lld / %2$lld"
"value" : "Processes with a CPU power reading: %1$lld of %2$lld enumerated"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "有效区间进程数 / 枚举数:%1$lld / %2$lld"
"value" : "已测得 CPU 功率的进程:%1$lld / %2$lld"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "有效區間程序數 / 列舉數:%1$lld / %2$lld"
"value" : "已測得 CPU 功率的程序:%1$lld / %2$lld"
}
}
}
@@ -1828,7 +1938,7 @@
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d 核"
"value" : "%d 核心"
}
}
}
@@ -2051,7 +2161,7 @@
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "應用程式記憶體"
"value" : "App 記憶體"
}
}
}
@@ -2212,7 +2322,7 @@
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "連動記憶體"
"value" : "系統核心記憶體"
}
}
}
@@ -2623,19 +2733,19 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "APFS volumes may share capacity; do not add totals."
"value" : "APFS volumes may share capacity. Summing them can count the same space twice."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "APFS 卷可能共享容量,不合算总量。"
"value" : "APFS 卷可能共享容量,直接相加会重复计算。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "APFS 卷宗可能共用容量,不加總。"
"value" : "APFS 卷宗可能共用容量,直接加總會重複計算。"
}
}
}
@@ -3157,13 +3267,13 @@
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "开机时间"
"value" : "运行时长"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "開機時間"
"value" : "運作時間"
}
}
}