-
-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement UI string translation using data collections #78
Conversation
🦋 Changeset detectedLatest commit: 898aa56 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
size-limit report 📦
|
This looks great @delucis but I'm wondering if you need to change something else in the astro.config.mjs file to be able to see the updated UI in german? |
It works in the preview 😃 |
Support supplying translation strings as part of starlight package so that users hopefully don’t need to do it themselves.
What kind of changes does this PR include?
Description
Users can provide translations in JSON files in
src/content/i18n/
which is a data collection, for example asrc/content/i18n/de.json
:In Starlight templates, we look up strings for the current locale from this data collection, falling back to the user-configured default locale, or to Starlight’s English defaults. This PR also adds built-in support for Spanish & German. The aim would be that for major languages we provide language support out of the box and users only need manual config to override labels or if they support less common languages.
Not included
Mapping languages to dictionaries is a bit basic so far, e.g.
de-CH
wouldn’t findde
translations. Leaving that to a follow-up PR, e.g with a library like https://github.com/wooorm/bcp-47-match