You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update i18n spec to reflect YAML UI strings implementation
- Change all UI string file references from .json to .yaml
- Update en.yaml schema example to match current complete key set
- Update locales.properties example to list all 9 supported locales
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
headline: Modernize your Java codebase with GitHub Copilot.
189
+
description: Let Copilot help you migrate legacy patterns to modern Java — automatically.
190
+
appModernization: App Modernization →
191
+
javaGuide: Java Guide →
192
+
support:
193
+
available: Available
194
+
preview: Preview
195
+
experimental: Experimental
196
+
contribute:
197
+
button: Contribute
198
+
codeIssue: Report a code issue
199
+
translationIssue: Report a translation issue
200
+
suggestPattern: Suggest a new pattern
201
+
seeIssue: "See a problem with this code?"
202
+
reportIt: "Let us know."
203
+
untranslated:
204
+
notice: This page has not yet been translated into {{localeName}}.
205
+
viewInEnglish: View in English
163
206
```
164
207
165
-
```json
166
-
// translations/strings/pt-BR.json (partial — only translated keys required)
167
-
{
168
-
"site": {
169
-
"tagline": "O Java evoluiu. Seu código também pode.",
170
-
"description": "Uma coleção de snippets modernos de Java..."
171
-
},
172
-
"nav": {
173
-
"allPatterns": "← Todos os padrões",
174
-
"toggleTheme": "Alternar tema"
175
-
},
176
-
"sections": {
177
-
"codeComparison": "Comparação de código",
178
-
"whyModernWins": "Por que a forma moderna ganha",
179
-
"howItWorks": "Como funciona",
180
-
"relatedDocs": "Documentação relacionada",
181
-
"relatedPatterns": "Padrões relacionados"
182
-
}
183
-
}
208
+
```yaml
209
+
# translations/strings/pt-BR.yaml (partial — only translated keys required)
210
+
site:
211
+
tagline: O Java evoluiu. Seu código também pode.
212
+
description: Uma coleção de snippets modernos de Java...
213
+
nav:
214
+
allPatterns: ← Todos os padrões
215
+
toggleTheme: Alternar tema
216
+
sections:
217
+
codeComparison: Comparação de código
218
+
whyModernWins: Por que a forma moderna ganha
219
+
howItWorks: Como funciona
220
+
relatedDocs: Documentação relacionada
221
+
relatedPatterns: Padrões relacionados
184
222
```
185
223
186
-
**Key-level fallback rule:** if a key present in `en.json` is absent from a
224
+
**Key-level fallback rule:** if a key present in `en.yaml` is absent from a
187
225
locale file, the generator uses the English value and emits a build-time warning:
188
226
189
227
```
190
-
[WARN] strings/pt-BR.json: missing key "footer.madeWith" — using English fallback
228
+
[WARN] pt-BR.yaml: missing key "footer.madeWith" — using English fallback
191
229
```
192
230
193
231
The page is always rendered completely; no key is ever silently blank. The warning
@@ -210,7 +248,7 @@ Every field in a slug definition file falls into one of three categories:
210
248
|---|---|---|
211
249
| **Translate** (include in translation file) | `title`, `summary`, `explanation`, `oldApproach`, `modernApproach`, `whyModernWins` (full array), `support.description` | These are the **only** fields present in a translation file |
212
250
| **English source of truth** (never in translation file) | `id`, `slug`, `category`, `difficulty`, `jdkVersion`, `oldLabel`, `modernLabel`, `oldCode`, `modernCode`, `prev`, `next`, `related`, `docs` | Always taken from the English content file; any values in the translation file are ignored |
213
-
|**Translated via UI strings**|`difficulty`, `support.state`| Enum values stay in English; display names resolved from `translations/strings/{locale}.json` at build time |
251
+
| **Translated via UI strings** | `difficulty`, `support.state` | Enum values stay in English; display names resolved from `translations/strings/{locale}.yaml` at build time |
214
252
215
253
**Why enum fields use UI strings instead of content translation:**
216
254
@@ -267,8 +305,8 @@ For each pattern and locale the generator:
267
305
`whyModernWins`, `support.description`) from the translation file.
268
306
- **No** → use the English file and inject an "untranslated" banner
269
307
(see next section).
270
-
3. Loads `translations/strings/<locale>.json` deep-merged over `en.json`.
271
-
Any key present in `en.json` but absent from the locale file falls back to
308
+
3. Loads `translations/strings/<locale>.yaml` deep-merged over `en.yaml`.
309
+
Any key present in `en.yaml` but absent from the locale file falls back to
272
310
the English value; the generator logs a `[WARN]` for each missing key and
273
311
continues without aborting.
274
312
4. Renders the template, substituting content tokens (`{{title}}`, …) and
@@ -295,7 +333,7 @@ The banner is suppressed when the locale is `en` or a translation file exists.
295
333
## Template Changes
296
334
297
335
Every hard-coded English string in the templates is replaced with a token whose
298
-
name mirrors the dot-separated key path in `strings/{locale}.json`:
336
+
name mirrors the dot-separated key path in `strings/{locale}.yaml`:
299
337
300
338
| Before | After |
301
339
|---|---|
@@ -516,9 +554,9 @@ mixed freely (e.g., strings in YAML, some content in JSON).
516
554
517
555
| Phase | Work |
518
556
|---|---|
519
-
| 1 | Extract every hard-coded string from templates into `translations/strings/en.json`; replace literals with `{{…}}` tokens; verify English output is unchanged |
557
+
| 1 | Extract every hard-coded string from templates into `translations/strings/en.yaml`; replace literals with `{{…}}` tokens; verify English output is unchanged |
520
558
| 2 | Add `locales.properties`; extend generator to load strings, support `--locale`, and fall back gracefully |
521
559
| 3 | Add language selector to nav; implement `app.js` locale detection and path rewrite |
522
-
| 4 | Translate `strings/pt-BR.json` and 2–3 content files as a proof-of-concept; verify fallback banner |
560
+
| 4 | Translate `strings/pt-BR.yaml` and 2–3 content files as a proof-of-concept; verify fallback banner |
0 commit comments