Skip to content
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

docs: refactor sidebar label translations examples to use tags with regional subtags #881

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/src/content/docs/guides/sidebar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ The configuration above generates the following sidebar:

## Internationalization

Use the `translations` property on link and group entries to translate the link or group label for each supported language.
Use the `translations` property on link and group entries to translate the link or group label for each supported language by specifying a BCP-47 language tag, e.g. `"en"`, `"ar"`, or `"zh-CN"`, as the key and the translated label as the value.
delucis marked this conversation as resolved.
Show resolved Hide resolved
The `label` property will be used for the default locale and for languages without a translation.

```js
Expand All @@ -369,20 +369,20 @@ starlight({
{
label: 'Guides',
translations: {
es: 'Guías',
'pt-BR': 'Guias',
},
items: [
{
label: 'Components',
translations: {
es: 'Componentes',
'pt-BR': 'Componentes',
},
link: '/guides/components/',
},
{
label: 'Internationalization (i18n)',
translations: {
es: 'Internacionalización (i18n)',
'pt-BR': 'Internacionalização (i18n)',
},
link: '/guides/i18n/',
},
Expand All @@ -392,15 +392,15 @@ starlight({
});
```

Browsing the documentation in Spanish will generate the following sidebar:
Browsing the documentation in Brazilian Portuguese will generate the following sidebar:

<SidebarPreview
config={[
{
label: 'Guías',
label: 'Guias',
items: [
{ label: 'Componentes', link: '/es/guides/components/' },
{ label: 'Internacionalización (i18n)', link: '/es/guides/i18n/' },
{ label: 'Componentes', link: '/pt-br/guides/components/' },
{ label: 'Internacionalização (i18n)', link: '/pt-br/guides/i18n/' },
],
},
]}
Expand Down
8 changes: 4 additions & 4 deletions docs/src/content/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,19 @@ If your site is multilingual, each item’s `label` is considered to be in the d

```js
sidebar: [
// An example sidebar with labels translated to French.
// An example sidebar with labels translated to Brazilian Portuguese.
{
label: 'Start Here',
translations: { fr: 'Commencez ici' },
translations: { 'pt-BR': 'Comece Aqui' },
items: [
{
label: 'Getting Started',
translations: { fr: 'Bien démarrer' },
translations: { 'pt-BR': 'Introdução' },
link: '/getting-started',
},
{
label: 'Project Structure',
translations: { fr: 'Structure du projet' },
translations: { 'pt-BR': 'Estrutura de Projetos' },
link: '/structure',
},
],
Expand Down