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 {
5959 var body: some View {
6060 switch family {
6161 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")))
6363 case .accessoryCircular:
6464 ZStack {
6565 AccessoryWidgetBackground()
@@ -69,11 +69,11 @@ struct NextEntryView: View {
6969 }
7070 }
7171 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")) }
7373 default:
7474 VStack(alignment: .leading, spacing: 0) {
75 Text(next?.gutter ?? "Agenda").font(.headline).widgetAccentable().lineLimit(1)
76 Text(next?.title ?? (entry.agenda == nil ? "Open orgstar" : "Nothing left today")).lineLimit(2)
75 Text(next?.gutter ?? String(localized: "Agenda")).font(.headline).widgetAccentable().lineLimit(1)
76 Text(next?.title ?? (entry.agenda == nil ? String(localized: "Open orgstar") : String(localized: "Nothing left today"))).lineLimit(2)
7777 }
7878 .frame(maxWidth: .infinity, alignment: .leading)
7979 }
Sources/OrgstarWidgets/Controls.swift +5 −4
@@ -9,7 +9,7 @@ struct CaptureControl: ControlWidget {
99 var body: some ControlWidgetConfiguration {
1010 AppIntentControlConfiguration(kind: "sh.krz.orgstar.capture-control", intent: CaptureControlConfiguration.self) { configuration in
1111 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")
1313 }
1414 }
1515 .displayName("Capture")
@@ -23,7 +23,8 @@ struct ClockControl: ControlWidget {
2323 var body: some ControlWidgetConfiguration {
2424 StaticControlConfiguration(kind: "sh.krz.orgstar.clock-control", provider: ClockValueProvider()) { clock in
2525 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"),
2728 systemImage: isOn ? "stopwatch.fill" : "stopwatch")
2829 }
2930 .tint(.orange)
@@ -88,7 +89,7 @@ struct CaptureView: View {
8889 Image(systemName: "square.and.pencil").font(.title3)
8990 VStack(alignment: .leading, spacing: 0) {
9091 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)
9293 }
9394 Spacer(minLength: 0)
9495 }
@@ -96,7 +97,7 @@ struct CaptureView: View {
9697 }
9798 .widgetURL(AppLink.capture(template: entry.template?.id).url)
9899 .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"))
100101 }
101102}
102103#endif
Sources/OrgstarWidgets/TodayWidget.swift +1 −1
@@ -85,7 +85,7 @@ struct TodayView: View {
8585 }
8686
8787 @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 {
8989 if rows.isEmpty {
9090 Text(empty).font(.caption).foregroundStyle(.secondary)
9191 }
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
230230orgstar 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.
231231
232232- 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.
234234
235235** The clock's Live Activity
236236
l10n/Localizable.xcstrings +102
@@ -6001,6 +6001,40 @@
60016001 }
60026002 }
60036003 },
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 },
60046038 "Capture, the agenda, today's entries and the clock, from any app. When off, the menu bar shows orgstar only while a clock runs.": {
60056039 "localizations": {
60066040 "de": {
@@ -13589,6 +13623,40 @@
1358913623 }
1359013624 }
1359113625 },
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 },
1359213660 "Folder": {
1359313661 "localizations": {
1359413662 "de": {
@@ -21553,6 +21621,40 @@
2155321621 }
2155421622 }
2155521623 },
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 },
2155621658 "Node Graph": {
2155721659 "localizations": {
2155821660 "de": {