Commit aa329aa6f4

aa329aa6f4ae524da1d5f31dc09d3bead590038d

parent: 2d27bbd039

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 20:49 UTC

Widgets, Controls and complications: localized fallbacks

The Clock control reads "Clock In to %@" as the watch app does.

Ref #224

Layout: unified · split

Sources/OrgstarWatchWidgets/WatchWidgets.swift +4 −4
@@ -59,7 +59,7 @@ struct NextEntryView: View {
59 var body: some View { 59 var body: some View {
60 switch family { 60 switch family {
61 case .accessoryInline: 61 case .accessoryInline:
62 Text(next.map { "\($0.gutter) \($0.title)" } ?? (open == 0 ? "Agenda clear" : "\(open) open today")) 62 Text(next.map { "\($0.gutter) \($0.title)" } ?? (open == 0 ? String(localized: "Agenda clear") : String(localized: "\(open) open today")))
63 case .accessoryCircular: 63 case .accessoryCircular:
64 ZStack { 64 ZStack {
65 AccessoryWidgetBackground() 65 AccessoryWidgetBackground()
@@ -69,11 +69,11 @@ struct NextEntryView: View {
69 } 69 }
70 } 70 }
71 case .accessoryCorner: 71 case .accessoryCorner:
72 Text("\(open)").font(.title3.weight(.semibold)).widgetLabel { Text(next?.title ?? "Agenda clear") } 72 Text("\(open)").font(.title3.weight(.semibold)).widgetLabel { Text(next?.title ?? String(localized: "Agenda clear")) }
73 default: 73 default:
74 VStack(alignment: .leading, spacing: 0) { 74 VStack(alignment: .leading, spacing: 0) {
75 Text(next?.gutter ?? "Agenda").font(.headline).widgetAccentable().lineLimit(1) 75 Text(next?.gutter ?? String(localized: "Agenda")).font(.headline).widgetAccentable().lineLimit(1)
76 Text(next?.title ?? (entry.agenda == nil ? "Open orgstar" : "Nothing left today")).lineLimit(2) 76 Text(next?.title ?? (entry.agenda == nil ? String(localized: "Open orgstar") : String(localized: "Nothing left today"))).lineLimit(2)
77 } 77 }
78 .frame(maxWidth: .infinity, alignment: .leading) 78 .frame(maxWidth: .infinity, alignment: .leading)
79 } 79 }
Sources/OrgstarWidgets/Controls.swift +5 −4
@@ -9,7 +9,7 @@ struct CaptureControl: ControlWidget {
9 var body: some ControlWidgetConfiguration { 9 var body: some ControlWidgetConfiguration {
10 AppIntentControlConfiguration(kind: "sh.krz.orgstar.capture-control", intent: CaptureControlConfiguration.self) { configuration in 10 AppIntentControlConfiguration(kind: "sh.krz.orgstar.capture-control", intent: CaptureControlConfiguration.self) { configuration in
11 ControlWidgetButton(action: OpenCaptureIntent(template: configuration.template)) { 11 ControlWidgetButton(action: OpenCaptureIntent(template: configuration.template)) {
12 Label(configuration.template?.name ?? "Capture", systemImage: "square.and.pencil") 12 Label(configuration.template?.name ?? String(localized: "Capture"), systemImage: "square.and.pencil")
13 } 13 }
14 } 14 }
15 .displayName("Capture") 15 .displayName("Capture")
@@ -23,7 +23,8 @@ struct ClockControl: ControlWidget {
23 var body: some ControlWidgetConfiguration { 23 var body: some ControlWidgetConfiguration {
24 StaticControlConfiguration(kind: "sh.krz.orgstar.clock-control", provider: ClockValueProvider()) { clock in 24 StaticControlConfiguration(kind: "sh.krz.orgstar.clock-control", provider: ClockValueProvider()) { clock in
25 ControlWidgetToggle("Clock", isOn: clock.running != nil, action: ClockToggleIntent()) { isOn in 25 ControlWidgetToggle("Clock", isOn: clock.running != nil, action: ClockToggleIntent()) { isOn in
26 Label(isOn ? clock.running ?? "Clocked in" : clock.last.map { "In: \($0)" } ?? "No recent clock", 26 Label(isOn ? clock.running ?? String(localized: "Clocked in")
27 : clock.last.map { String(localized: "Clock In to \($0)") } ?? String(localized: "No recent clock"),
27 systemImage: isOn ? "stopwatch.fill" : "stopwatch") 28 systemImage: isOn ? "stopwatch.fill" : "stopwatch")
28 } 29 }
29 .tint(.orange) 30 .tint(.orange)
@@ -88,7 +89,7 @@ struct CaptureView: View {
88 Image(systemName: "square.and.pencil").font(.title3) 89 Image(systemName: "square.and.pencil").font(.title3)
89 VStack(alignment: .leading, spacing: 0) { 90 VStack(alignment: .leading, spacing: 0) {
90 Text("Capture").font(.headline) 91 Text("Capture").font(.headline)
91 Text(entry.template?.name ?? "First template").font(.caption).foregroundStyle(.secondary).lineLimit(1) 92 Text(entry.template?.name ?? String(localized: "First template")).font(.caption).foregroundStyle(.secondary).lineLimit(1)
92 } 93 }
93 Spacer(minLength: 0) 94 Spacer(minLength: 0)
94 } 95 }
@@ -96,7 +97,7 @@ struct CaptureView: View {
96 } 97 }
97 .widgetURL(AppLink.capture(template: entry.template?.id).url) 98 .widgetURL(AppLink.capture(template: entry.template?.id).url)
98 .containerBackground(for: .widget) { Color.clear } 99 .containerBackground(for: .widget) { Color.clear }
99 .accessibilityLabel("Capture" + (entry.template.map { " with \($0.name)" } ?? "")) 100 .accessibilityLabel(entry.template.map { Text("Capture with \($0.name)") } ?? Text("Capture"))
100 } 101 }
101} 102}
102#endif 103#endif
Sources/OrgstarWidgets/TodayWidget.swift +1 −1
@@ -85,7 +85,7 @@ struct TodayView: View {
85 } 85 }
86 86
87 @ViewBuilder 87 @ViewBuilder
88 private func rows(_ rows: [AgendaSnapshot.Row], _ snapshot: AgendaSnapshot, compact: Bool, empty: String) -> some View { 88 private func rows(_ rows: [AgendaSnapshot.Row], _ snapshot: AgendaSnapshot, compact: Bool, empty: LocalizedStringKey) -> some View {
89 if rows.isEmpty { 89 if rows.isEmpty {
90 Text(empty).font(.caption).foregroundStyle(.secondary) 90 Text(empty).font(.caption).foregroundStyle(.secondary)
91 } 91 }
docs/manual/guide/14-ios.org +1 −1
@@ -230,7 +230,7 @@ Widgets can't read your folders, so the app writes the next seven days of the ag
230orgstar has two controls for Control Center, the Lock Screen and the Action button. Add them as any control: in Control Center, touch and hold an empty space and tap Add a Control, then choose orgstar. 230orgstar has two controls for Control Center, the Lock Screen and the Action button. Add them as any control: in Control Center, touch and hold an empty space and tap Add a Control, then choose orgstar.
231 231
232- Capture :: opens the capture sheet. Touch and hold it while editing Control Center to choose a template; without one it uses the first. 232- Capture :: opens the capture sheet. Touch and hold it while editing Control Center to choose a template; without one it uses the first.
233- Clock :: on while a clock runs, showing its entry. Turning it off clocks out; turning it on clocks in to the entry clocked last (Clock In Last). If a clock was left running elsewhere, orgstar asks in the app how to resolve it. 233- Clock :: on while a clock runs, showing its entry; off, it shows Clock In to /heading/ for the entry clocked last. Turning it off clocks out; turning it on clocks in to the entry clocked last (Clock In Last). If a clock was left running elsewhere, orgstar asks in the app how to resolve it.
234 234
235** The clock's Live Activity 235** The clock's Live Activity
236 236
l10n/Localizable.xcstrings +102
@@ -6001,6 +6001,40 @@
6001 } 6001 }
6002 } 6002 }
6003 }, 6003 },
6004 "Capture with %@": {
6005 "localizations": {
6006 "de": {
6007 "stringUnit": {
6008 "state": "translated",
6009 "value": "Mit %@ erfassen"
6010 }
6011 },
6012 "es": {
6013 "stringUnit": {
6014 "state": "translated",
6015 "value": "Capturar con %@"
6016 }
6017 },
6018 "fr": {
6019 "stringUnit": {
6020 "state": "translated",
6021 "value": "Capturer avec %@"
6022 }
6023 },
6024 "ja": {
6025 "stringUnit": {
6026 "state": "translated",
6027 "value": "%@でキャプチャ"
6028 }
6029 },
6030 "pt-BR": {
6031 "stringUnit": {
6032 "state": "translated",
6033 "value": "Capturar com %@"
6034 }
6035 }
6036 }
6037 },
6004 "Capture, the agenda, today's entries and the clock, from any app. When off, the menu bar shows orgstar only while a clock runs.": { 6038 "Capture, the agenda, today's entries and the clock, from any app. When off, the menu bar shows orgstar only while a clock runs.": {
6005 "localizations": { 6039 "localizations": {
6006 "de": { 6040 "de": {
@@ -13589,6 +13623,40 @@
13589 } 13623 }
13590 } 13624 }
13591 }, 13625 },
13626 "First template": {
13627 "localizations": {
13628 "de": {
13629 "stringUnit": {
13630 "state": "translated",
13631 "value": "Erste Vorlage"
13632 }
13633 },
13634 "es": {
13635 "stringUnit": {
13636 "state": "translated",
13637 "value": "Primera plantilla"
13638 }
13639 },
13640 "fr": {
13641 "stringUnit": {
13642 "state": "translated",
13643 "value": "Premier modèle"
13644 }
13645 },
13646 "ja": {
13647 "stringUnit": {
13648 "state": "translated",
13649 "value": "最初のテンプレート"
13650 }
13651 },
13652 "pt-BR": {
13653 "stringUnit": {
13654 "state": "translated",
13655 "value": "Primeiro modelo"
13656 }
13657 }
13658 }
13659 },
13592 "Folder": { 13660 "Folder": {
13593 "localizations": { 13661 "localizations": {
13594 "de": { 13662 "de": {
@@ -21553,6 +21621,40 @@
21553 } 21621 }
21554 } 21622 }
21555 }, 21623 },
21624 "No recent clock": {
21625 "localizations": {
21626 "de": {
21627 "stringUnit": {
21628 "state": "translated",
21629 "value": "Keine letzte Zeiterfassung"
21630 }
21631 },
21632 "es": {
21633 "stringUnit": {
21634 "state": "translated",
21635 "value": "Sin registro reciente"
21636 }
21637 },
21638 "fr": {
21639 "stringUnit": {
21640 "state": "translated",
21641 "value": "Aucun chronométrage récent"
21642 }
21643 },
21644 "ja": {
21645 "stringUnit": {
21646 "state": "translated",
21647 "value": "最近のクロックはありません"
21648 }
21649 },
21650 "pt-BR": {
21651 "stringUnit": {
21652 "state": "translated",
21653 "value": "Nenhum registro recente"
21654 }
21655 }
21656 }
21657 },
21556 "Node Graph": { 21658 "Node Graph": {
21557 "localizations": { 21659 "localizations": {
21558 "de": { 21660 "de": {