Skip to content

Commit 4c85e4b

Browse files
committed
Localization: convert non-translatable SwiftUI Text literals to Text(verbatim:)
Prep for enabling `--SwiftUI-Text` extraction (#25700). `xcstringstool extract --SwiftUI-Text` pulls in every `Text("literal")`, so the non-translatable ones have to opt out via `verbatim:` first or they reach translators as garbage. Audited all 94 `Text("…")` literals and converted the 84 non-translatable ones: glyphs/dividers/specimens (`–`, `·`, `Aa`, `••••`, `👋`), brand names (`WordPress.com`), pure interpolations (`@\(username)`, `\(count)`), and dev-only strings in `#Preview` blocks, Developer/Debug-menu screens, and the unwired Realtime stats feature. Kept the 10 that should stay `Text("…")`: user-facing words that now correctly localize (`Sign In`, `Update available`, `%lld characters`, the shipping Insights/Subscribers placeholders), the `^[…](inflect: true)` morphology string (`verbatim:` would render the markup literally), and `Text(" " + Strings.title)` (an expression, not a literal — never extracted). No behavior change: `verbatim:` renders these strings identically.
1 parent 594a3be commit 4c85e4b

54 files changed

Lines changed: 84 additions & 84 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Modules/Sources/AsyncImageKit/Views/CachedAsyncImage.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ fileprivate let videoURL = URL(
177177
CachedAsyncImage(url: testURL) { image in
178178
image.resizable().scaledToFit()
179179
} placeholder: {
180-
Text("Loading")
180+
Text(verbatim: "Loading")
181181
}
182182
}
183183

184184
#Preview("Image that never loads") {
185185
CachedAsyncImage(url: nil) { _ in
186-
Text("This shouldn't be visible")
186+
Text(verbatim: "This shouldn't be visible")
187187
} placeholder: {
188188
ProgressView("Forever loading...")
189189
}
@@ -220,6 +220,6 @@ fileprivate let videoURL = URL(
220220
CachedAsyncImage(videoUrl: videoURL) { image in
221221
image.resizable().aspectRatio(contentMode: .fit)
222222
} placeholder: {
223-
Text("Loading")
223+
Text(verbatim: "Loading")
224224
}
225225
}

Modules/Sources/JetpackStats/Cards/ChartCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ struct ChartCardHeaderView: View {
348348
}
349349
}
350350
if viewModel.showComparison {
351-
Text("\(viewModel.trend.formattedChange) \(viewModel.trend.iconSign) \(viewModel.trend.formattedPercentage)")
351+
Text(verbatim: "\(viewModel.trend.formattedChange) \(viewModel.trend.iconSign) \(viewModel.trend.formattedPercentage)")
352352
.font(.caption.weight(.semibold))
353353
.foregroundColor(viewModel.trend.sentiment.foregroundColor)
354354
.contentTransition(.numericText())

Modules/Sources/JetpackStats/Cards/RealtimeMetricsCard.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct RealtimeMetricsCard: View {
1414
VStack(alignment: .leading, spacing: 20) {
1515
VStack(alignment: .leading, spacing: 0) {
1616
HStack(spacing: 0) {
17-
Text("Realtime")
17+
Text(verbatim: "Realtime")
1818
.font(.headline)
1919
.foregroundColor(.primary)
2020
Circle()
@@ -28,7 +28,7 @@ struct RealtimeMetricsCard: View {
2828
Spacer()
2929
}
3030

31-
Text("Last 30 minutes")
31+
Text(verbatim: "Last 30 minutes")
3232
.font(.subheadline.smallCaps()).fontWeight(.medium)
3333
.foregroundColor(.secondary)
3434
}

Modules/Sources/JetpackStats/Cards/RealtimeTopListCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct RealtimeTopListCard: View {
6868

6969
Spacer()
7070

71-
Text("Views")
71+
Text(verbatim: "Views")
7272
.font(.subheadline.weight(.medium))
7373
.foregroundStyle(.secondary)
7474
}

Modules/Sources/JetpackStats/Charts/PieChartView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct PieChartView: View {
2222
.cornerRadius(5)
2323
.annotation(position: .overlay) {
2424
if shouldShowAnnotation(for: segment) {
25-
Text("\(segment.name.capitalized) \((segment.percentage / 100).formatted(.percent.precision(.fractionLength(1))))")
25+
Text(verbatim: "\(segment.name.capitalized) \((segment.percentage / 100).formatted(.percent.precision(.fractionLength(1))))")
2626
.font(.caption2)
2727
.fontWeight(.medium)
2828
.foregroundStyle(.white)

Modules/Sources/JetpackStats/Screens/PostStatsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ private struct PostLikesStripView: View {
578578

579579
// Show additional count if there are more users
580580
if likes.totalCount > maxVisibleAvatars {
581-
Text("+\((likes.totalCount - maxVisibleAvatars).formatted(.number.notation(.compactName)))")
581+
Text(verbatim: "+\((likes.totalCount - maxVisibleAvatars).formatted(.number.notation(.compactName)))")
582582
.font(.caption2.weight(.medium))
583583
.foregroundColor(.primary.opacity(0.8))
584584
.padding(.horizontal, 4)

Modules/Sources/JetpackStats/Screens/RealtimeTabView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct RealtimeTabView: View {
99
ScrollView {
1010
VStack(spacing: Constants.step3) {
1111
realtimeStatsCard
12-
Text("Showing Mock Data")
12+
Text(verbatim: "Showing Mock Data")
1313
.font(.subheadline.weight(.medium))
1414
.foregroundStyle(.secondary)
1515
.frame(maxWidth: .infinity, alignment: .center)

Modules/Sources/JetpackStats/Views/BadgeTrendIndicator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ struct BadgeTrendIndicator: View {
2626

2727
#Preview("Change Indicators") {
2828
VStack(spacing: 20) {
29-
Text("Examples").font(.headline)
29+
Text(verbatim: "Examples").font(.headline)
3030
// 15% increase in views - positive sentiment
3131
BadgeTrendIndicator(trend: TrendViewModel(currentValue: 115, previousValue: 100, metric: SiteMetric.views))
3232
// 15% decrease in views - negative sentiment
3333
BadgeTrendIndicator(trend: TrendViewModel(currentValue: 85, previousValue: 100, metric: SiteMetric.views))
3434
// 0.1% increase in views - negative sentiment
3535
BadgeTrendIndicator(trend: TrendViewModel(currentValue: 1001, previousValue: 1000, metric: SiteMetric.views))
3636

37-
Text("Edge Cases").font(.headline).padding(.top)
37+
Text(verbatim: "Edge Cases").font(.headline).padding(.top)
3838
// No change
3939
BadgeTrendIndicator(trend: TrendViewModel(currentValue: 100, previousValue: 100, metric: SiteMetric.views))
4040
// Division by zero (from 0 to 100)

Modules/Sources/JetpackStats/Views/CustomDateRangePicker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private struct QuickPeriodButtonView: View {
209209
.ignoresSafeArea()
210210

211211
VStack {
212-
Text("Main View")
212+
Text(verbatim: "Main View")
213213
.font(.largeTitle)
214214

215215
Button("Show Date Picker") {

Modules/Sources/JetpackStats/Views/StatsCardTitleView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct StatsCardTitleView: View {
2626
if showChevron {
2727
// Note: had to do that to fix the animation issuse with Menu
2828
// hiding the image.
29-
title + Text(" ") + Text(Image(systemName: "chevron.up.chevron.down"))
29+
title + Text(verbatim: " ") + Text(Image(systemName: "chevron.up.chevron.down"))
3030
.font(.caption2.weight(.semibold))
3131
.foregroundColor(.secondary)
3232
.baselineOffset(1)
@@ -59,7 +59,7 @@ struct InlineValuePickerTitle: View {
5959

6060
// Note: had to do that to fix the animation issuse with Menu
6161
// hiding the image.
62-
title + Text(" ") + Text(Image(systemName: "chevron.up.chevron.down"))
62+
title + Text(verbatim: " ") + Text(Image(systemName: "chevron.up.chevron.down"))
6363
.font(.caption2.weight(.semibold))
6464
.foregroundColor(.secondary)
6565
.baselineOffset(1)

0 commit comments

Comments
 (0)