Skip to content

Commit 0901c01

Browse files
committed
Localization: use Text(verbatim:) for SwiftUI preview strings
`xcstringstool extract --SwiftUI-Text` extracts every `Text("literal")` — including the placeholder/sample strings inside `#Preview` and `PreviewProvider` blocks, which never ship to users. Wrap those 23 literals in `Text(verbatim:)` so they're excluded from translation. Scoped to preview strings; the broader non-translatable cleanup (glyphs, brand names, developer/debug screens, the unwired Realtime feature) is deferred to a separate PR.
1 parent 7d67a88 commit 0901c01

10 files changed

Lines changed: 23 additions & 23 deletions

File tree

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/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/Support/UI/FX/ShimmerEffect.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,30 @@ extension View {
4141

4242
#Preview {
4343
VStack(spacing: 30) {
44-
Text("Thinking...")
44+
Text(verbatim: "Thinking...")
4545
.font(.largeTitle)
4646
.fontWeight(.bold)
4747
.shimmer()
4848
.foregroundStyle(.gray)
4949

50-
Text("Thinking...")
50+
Text(verbatim: "Thinking...")
5151
.font(.title2)
5252
.fontWeight(.semibold)
5353
.shimmer()
5454
.foregroundStyle(.orange)
5555

56-
Text("Thinking...")
56+
Text(verbatim: "Thinking...")
5757
.font(.body)
5858
.fontWeight(.bold)
5959
.shimmer()
6060
.foregroundStyle(.blue)
6161

62-
Text("Thinking...")
62+
Text(verbatim: "Thinking...")
6363
.font(.body)
6464
.shimmer()
6565
.foregroundStyle(.pink)
6666

67-
Text("Thinking...")
67+
Text(verbatim: "Thinking...")
6868
.font(.caption)
6969
.shimmer()
7070
.foregroundStyle(.green)

Modules/Sources/Support/UI/OverlayProgressView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ struct OverlayProgressView: View {
9393
NavigationStack {
9494
List {
9595
ForEach(0..<12) { i in
96-
Text("Row \(i)")
96+
Text(verbatim: "Row \(i)")
9797
}
9898
}
9999
.navigationTitle("Demo")
100100
.toolbar {
101101
Button {
102102
shouldDisplay.toggle()
103103
} label: {
104-
Text("Toggle Progress View")
104+
Text(verbatim: "Toggle Progress View")
105105
}
106106
}
107107
}

Modules/Sources/Support/UI/Support Conversations/SupportConversationReplyView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public struct SupportConversationReplyView: View {
272272
var isPresented: Bool = true
273273

274274
NavigationStack {
275-
Text("Hello World").onTapGesture {
275+
Text(verbatim: "Hello World").onTapGesture {
276276
isPresented = true
277277
}
278278
}.sheet(isPresented: $isPresented) {

Modules/Sources/Support/UI/Support Conversations/SupportForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ private extension SupportFormArea {
422422
// MARK: - Previews
423423
#Preview {
424424
NavigationStack {
425-
Text("Support Form")
425+
Text(verbatim: "Support Form")
426426
}
427427
.sheet(isPresented: .constant(true)) {
428428
NavigationStack {

Modules/Sources/WordPressUI/Views/CardView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public struct CardView<Content: View>: View {
3333
#Preview("With Title") {
3434
CardView("Section Title") {
3535
VStack(alignment: .leading, spacing: 12) {
36-
Text("Card Content")
37-
Text("More content here")
36+
Text(verbatim: "Card Content")
37+
Text(verbatim: "More content here")
3838
.foregroundStyle(.secondary)
3939
}
4040
}
@@ -46,7 +46,7 @@ public struct CardView<Content: View>: View {
4646
HStack {
4747
Image(systemName: "star.fill")
4848
.foregroundStyle(.yellow)
49-
Text("Featured Item")
49+
Text(verbatim: "Featured Item")
5050
Spacer()
5151
}
5252
}

Modules/Sources/WordPressUI/Views/EmptyStateView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ extension EmptyStateView where Label == SwiftUI.Label<Text, Image>, Description
138138

139139
#Preview("Custom") {
140140
EmptyStateView {
141-
Text("You don't have any tags")
141+
Text(verbatim: "You don't have any tags")
142142
} description: {
143-
Text("Tags created here can be easily added to new posts")
143+
Text(verbatim: "Tags created here can be easily added to new posts")
144144
} actions: {
145145
Button {
146146
} label: {
147-
Text("Create Tag")
147+
Text(verbatim: "Create Tag")
148148
}
149149
.buttonStyle(.borderedProminent)
150150
}

Modules/Sources/WordPressUI/Views/InfoRow.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extension InfoRow where Content == Text {
5656
Circle()
5757
.fill(.green)
5858
.frame(width: 8, height: 8)
59-
Text("Active")
59+
Text(verbatim: "Active")
6060
.foregroundStyle(.green)
6161
}
6262
}
@@ -67,7 +67,7 @@ extension InfoRow where Content == Text {
6767

6868
InfoRow("Tags") {
6969
HStack(spacing: 4) {
70-
Text("Swift")
70+
Text(verbatim: "Swift")
7171
Image(systemName: "chevron.forward")
7272
.font(.caption2)
7373
}

0 commit comments

Comments
 (0)