Commit 458b492
fix: use region-specific translations for default locale instead of base language override
When a monolingual site uses a region-specific locale as the default (e.g., `zh-TW`),
`buildResources` for the default locale was loading both `builtinTranslations['zh-TW']`
and `builtinTranslations['zh']` as separate layers. Since `buildResources` applies later
layers over earlier ones, the base language (`zh` → Simplified Chinese) was overwriting
the region-specific translations (`zh-TW` → Traditional Chinese).
This fix aligns the default locale behavior with the locales loop (line 37), using `||`
so `stripLangRegion` result is only used as a fallback when the specific locale has no
built-in translations.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 3ce793a commit 458b492
2 files changed
Lines changed: 15 additions & 2 deletions
File tree
- packages/starlight
- __tests__/i18n-single-root-locale
- utils
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
0 commit comments