Commit 593ba17
authored
Localization: wrap non-translatable SwiftUI Text literals + document the rule (prep for swiftui: true) (#25701)
* Localization: document the non-translatable SwiftUI text rule
`xcstringstool` tags each extracted string with its compile gate (`visibility`);
`sync` admits only unconditional strings into the catalog, so `#Preview` /
`PreviewProvider` / `#if DEBUG` literals are excluded automatically — no
`verbatim:` needed. Document this, and that `Text(verbatim:)` is for
non-translatable literals in shipping code (glyphs, brands, pure interpolations).
* Localization: wrap non-translatable SwiftUI Text literals (prep for swiftui: true)
Once SwiftUI string extraction is enabled (`swiftui: true` on
generate_strings_catalog), `xcstringstool extract --SwiftUI-Text` pulls every
shipping `Text("literal")` into the String Catalog for translation — including
non-translatable literals that would reach GlotPress as garbage. Wrap those in
`Text(verbatim:)`, and fix a few numeric cases to format per the user's locale.
No behavior change.
- Glyphs/separators, brand names, pure string interpolations, HTTP status codes,
and developer/debug-screen text -> `Text(verbatim:)`.
- Bare numeric interpolations -> locale formatters: `Text(count, format: .number)`,
`Text(Double(progress) / 100, format: .percent)`, and `.formatted()` inside a
verbatim wrapper for decorated counts. A bare `Text("\(count)")` ships
unlocalized digits (no grouping, no locale numerals).
Left translatable on purpose: real UI strings, the `^[%@](inflect:)` string
(LocalizedStringKey inflection), and `example.com` (site-address placeholder).
Out of scope (separate changes): the unwired Realtime/Insights/Subscribers
strings, the `Overriden`->`Overridden` codebase-wide misspelling, the two
`"%@ characters"` strings (want proper plurals), and a `TODO:` placeholder in
ActivityLogDetailView's share sheet.1 parent 18dd66a commit 593ba17
39 files changed
Lines changed: 72 additions & 54 deletions
File tree
- Modules/Sources
- JetpackStats
- Cards
- Charts
- Screens
- Views
- TopList
- Rows
- Support/UI/Bot Conversations
- WordPress/Classes
- ApplicationToken
- Users/Views
- ViewRelated
- Activity
- Details
- List
- Blog
- Site Monitoring
- Subscribers
- Details
- List
- Developer
- Me/App Settings
- NUX/Controllers/UnifiedPrologue/ContentViews/Components
- Post
- PostSettings
- Views
- Views
- Reader
- Detail/Views
- Headers
- Theme
- User
- System/Sidebar
- Tags
- docs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
| 351 | + | |
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
581 | | - | |
| 581 | + | |
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| |||
0 commit comments