feat(i18n): add zh-CN UI translations and sidebar labels

- Add website/src/content/i18n/zh-CN.json with Starlight UI strings
- Add sidebar group label translations (欢迎, 路线图, 教程, etc.)
- Register i18n collection in content config to fix deprecation warning
This commit is contained in:
Alex Verkhovsky 2026-03-04 19:44:50 -07:00
parent 8765b1dabb
commit 96eec1cc22
3 changed files with 36 additions and 3 deletions

View File

@ -102,25 +102,29 @@ export default defineConfig({
// Sidebar configuration (Diataxis structure)
sidebar: [
{ label: 'Welcome', slug: 'index' },
{ label: 'Roadmap', slug: 'roadmap' },
{ label: 'Welcome', translations: { 'zh-CN': '欢迎' }, slug: 'index' },
{ label: 'Roadmap', translations: { 'zh-CN': '路线图' }, slug: 'roadmap' },
{
label: 'Tutorials',
translations: { 'zh-CN': '教程' },
collapsed: false,
autogenerate: { directory: 'tutorials' },
},
{
label: 'How-To Guides',
translations: { 'zh-CN': '操作指南' },
collapsed: true,
autogenerate: { directory: 'how-to' },
},
{
label: 'Explanation',
translations: { 'zh-CN': '概念说明' },
collapsed: true,
autogenerate: { directory: 'explanation' },
},
{
label: 'Reference',
translations: { 'zh-CN': '参考' },
collapsed: true,
autogenerate: { directory: 'reference' },
},

View File

@ -1,6 +1,7 @@
import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
export const collections = {
docs: defineCollection({ schema: docsSchema() }),
i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
};

View File

@ -0,0 +1,28 @@
{
"skipLink.label": "跳转到内容",
"search.label": "搜索",
"search.ctrlKey": "Ctrl",
"search.cancelLabel": "取消",
"themeSelect.accessibleLabel": "选择主题",
"themeSelect.dark": "深色",
"themeSelect.light": "浅色",
"themeSelect.auto": "自动",
"languageSelect.accessibleLabel": "选择语言",
"menuButton.accessibleLabel": "菜单",
"sidebarNav.accessibleLabel": "主导航",
"tableOfContents.onThisPage": "本页内容",
"tableOfContents.overview": "概述",
"i18n.untranslatedContent": "此内容尚未提供中文翻译。",
"page.editLink": "编辑页面",
"page.lastUpdated": "最后更新:",
"page.previousLink": "上一页",
"page.nextLink": "下一页",
"page.draft": "此内容为草稿,不会包含在正式版本中。",
"404.text": "页面未找到。请检查 URL 或尝试使用搜索。",
"aside.note": "注意",
"aside.tip": "提示",
"aside.caution": "警告",
"aside.danger": "危险",
"fileTree.directory": "目录",
"builtWithStarlight.label": "使用 Starlight 构建"
}