withastro / starlight

🌟 Build beautiful, accessible, high-performance documentation websites with Astro
https://starlight.astro.build
MIT License
5.05k stars 532 forks source link

Sidebar titles are not being updated when switching locales. #70

Closed dreyfus92 closed 1 year ago

dreyfus92 commented 1 year ago

What version of starlight are you using?

0.0.7

What version of astro are you using?

2.4.3

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

Titles on the sidebar are not being updated properly when you switch between locales.

image image

Link to Minimal Reproducible Example

No response

Participation

delucis commented 1 year ago

Oops! This definitely worked before but I probably broke it in #55. Thanks for reporting!

dreyfus92 commented 1 year ago

@delucis I will take a look to that PR later.

delucis commented 1 year ago

Oh wait, I remember now. Titles are translated for “autogenerated” sidebars currently (see the Reference section for example), but not yet for explicit entries in the sidebar.

So here’s the current sidebar config:

https://github.com/withastro/starlight/blob/c4731c5829ef23d43499856fc1fd5e8c36ef6f24/docs/astro.config.mjs#L42-L63

We’ll need to set up a way to translate the “Start Here” items. I was delaying this while figuring out other “string” translations (like ui.ts in the Astro docs). Might end up suggesting a format something like:

{
  label: 'Welcome, world',
  link: '/',
  translations: {
    de: 'Wilkommen, Welt',
  },
}