fix(ui): 校正三语指标文案并核对构建包译文
This commit is contained in:
@@ -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])
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user