-
Consider the following sidebar from sidebar: [
{
label: 'Book',
translations: { 'zh-CN': '图书' },
link: '#', attrs: { class: 'sidebar-separator' }
},
// other entries
] Where /* Add a sidebar separator */
.sidebar-separator {
margin-top: 1rem;
font-weight: 600;
pointer-events: none;
} When I switch the language in the top bar, only the entries with external links stay the same (in their English variant) — all other i18n-capable items. Am I missing something, or that's not implemented yet / a bug? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Thanks for the feedback 🙌 I did not manage to reproduce the issue you are facing. Considering the following Starlight internationalization configuration: locales: {
root: { label: "English", lang: "en" },
"zh-cn": { label: "简体中文", lang: "zh-CN" },
}, And the following sidebar configuration (which includes the link you shared): sidebar: [
{
label: "Guides",
translations: {
"zh-CN": "指南",
},
items: [
{ slug: "guides/example" },
{
label: "Getting Started",
translations: {
"zh-CN": "开始使用",
},
link: "https://starlight.astro.build/",
attrs: { class: "test-sidebar" },
},
{
label: "Book",
translations: { "zh-CN": "图书" },
link: "#",
attrs: { class: "sidebar-separator" },
},
],
},
], I properly get translated labels in the sidebar for the first internal link (which use the translated page title from content frontmatter), for the second external link (which uses the manually specified translations under the
You can also take a look at this StackBlitz example I just made to test this behavior. |
Beta Was this translation helpful? Give feedback.
No problem, I think the issue may be that some of your
translations
are using thezn-CN
key instead ofzh-CN
one.