From ba80d4d9c12efc606cc115485bbd1b4168b7e077 Mon Sep 17 00:00:00 2001 From: groupguanfang <1203970284@qq.com> Date: Tue, 22 Jul 2025 19:58:05 +0800 Subject: [PATCH 1/7] feat: add zh-cn translation (home page, core-concepts) --- astro.config.ts | 16 +++++- .../core-concepts/embedded-languages.mdx | 12 +++++ .../docs/zh-cn/core-concepts/volar-labs.mdx | 26 +++++++++ .../docs/zh-cn/core-concepts/why-volar.mdx | 10 ++++ src/content/docs/zh-cn/index.mdx | 53 +++++++++++++++++++ 5 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 src/content/docs/zh-cn/core-concepts/embedded-languages.mdx create mode 100644 src/content/docs/zh-cn/core-concepts/volar-labs.mdx create mode 100644 src/content/docs/zh-cn/core-concepts/why-volar.mdx create mode 100644 src/content/docs/zh-cn/index.mdx diff --git a/astro.config.ts b/astro.config.ts index 8834a22..51e0235 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -34,10 +34,11 @@ export default defineConfig({ sidebar: [ { label: "Core Concepts", + translations: { 'zh-CN': '核心概念' }, items: [ // Each item here is one entry in the navigation menu. - { label: "Why Volar?", link: "/core-concepts/why-volar" }, - { label: "Embedded Languages", link: "/core-concepts/embedded-languages" }, + { label: "Why Volar?", link: "/core-concepts/why-volar", translations: { 'zh-CN': '为什么选择 Volar?' } }, + { label: "Embedded Languages", link: "/core-concepts/embedded-languages", translations: { 'zh-CN': '嵌入式语言' } }, { label: "Volar Labs", link: "/core-concepts/volar-labs" }, ], // TODO: Use `autogenerate` once it allows you to order the sidebar @@ -54,6 +55,17 @@ export default defineConfig({ autogenerate: { directory: "reference" }, }, ], + defaultLocale: 'en', + locales: { + en: { + label: 'English', + lang: 'en-US', + }, + 'zh-cn': { + label: '简体中文', + lang: 'zh-CN', + } + } }), ], }); diff --git a/src/content/docs/zh-cn/core-concepts/embedded-languages.mdx b/src/content/docs/zh-cn/core-concepts/embedded-languages.mdx new file mode 100644 index 0000000..d28bd11 --- /dev/null +++ b/src/content/docs/zh-cn/core-concepts/embedded-languages.mdx @@ -0,0 +1,12 @@ +--- +title: 嵌入式语言 +description: VolarJS 对嵌入式语言提供了顶级支持,并可以大大简化在文件不同部分之间实现编辑功能所需的映射。 +--- + +如今,许多编程语言都是由其他编程语言组成的。最著名的例子是 HTML, 在其中你会发现 JavaScript 和 CSS 分别位于 `