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
If I create a multilingual site with only one non-English locale like this, the UI text (like "On this page") is not translated, but always English instead.
You have to visit /de/ in Stackblitz manually. For some reason, the redirect from / to /de/ doesn't seem to work in Stackblitz - in my local installation, it does.
Participation
I am willing to submit a pull request for this issue.
The text was updated successfully, but these errors were encountered:
sschultze
changed the title
UI text not translated when creating a multi-lingual site with only one locale
UI text not translated when creating a multilingual site with only one locale
Feb 24, 2024
Thank you for the report and the clear reproduction @sschultze!
I can confirm I’m seeing the same thing in your StackBlitz link. I think we never accounted for this situation with the expectation that monolingual sites always used the root as the default locale (as shown in our i18n guide), but this should work.
delucis
added
🐛 bug
Something isn't working
i18n
Anything to do with internationalization & translation efforts
labels
Feb 24, 2024
I did a little debugging and found out that the when returning the UserConfig it's expected to have "root" present but because of the Zod configuration it is not mandatory.
This would be fixed by changing this on user-config.ts:
/** Configure locales for internationalization (i18n). */
locales: z.object({/** Configure a “root” locale to serve a default language from `/`. */root: LocaleSchema.required({lang: true}).required(),})
Either way I've also noticed that if we set "root" plus another locale setting the "defaultLocale" has no effect.
What version of
starlight
are you using?0.20.1
What version of
astro
are you using?4.4.4
What package manager are you using?
npm
What operating system are you using?
Mac
What browser are you using?
Brave
Describe the Bug
If I create a multilingual site with only one non-English locale like this, the UI text (like "On this page") is not translated, but always English instead.
As soon as I add another locale, for example
fr
, the UI text of thede
locale is correctly translated to German.Why am I trying to create a multilingual site with only one locale in the first place? I want to prepare for translations in the future.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-4oxm53?file=astro.config.mjs
You have to visit
/de/
in Stackblitz manually. For some reason, the redirect from/
to/de/
doesn't seem to work in Stackblitz - in my local installation, it does.Participation
The text was updated successfully, but these errors were encountered: