From a26c77ec549936b316534e4bbec14800a2077993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=91=9E=E4=B8=B0?= Date: Wed, 11 Oct 2023 22:53:05 +0800 Subject: [PATCH 1/4] [i18nIgnore] i18n(zh-cn): Fix Chinese subtag (#855) Co-authored-by: Chris Swithinbank --- .github/labeler.yml | 2 +- docs/astro.config.mjs | 14 +++++------ docs/package.json | 2 +- docs/public/_redirects | 1 + .../docs/de/reference/configuration.md | 4 ++-- docs/src/content/docs/es/guides/i18n.mdx | 10 ++++---- .../docs/es/reference/configuration.md | 4 ++-- .../content/docs/es/reference/overrides.md | 2 +- docs/src/content/docs/fr/guides/i18n.mdx | 10 ++++---- .../docs/fr/reference/configuration.md | 4 ++-- docs/src/content/docs/guides/i18n.mdx | 10 ++++---- docs/src/content/docs/it/guides/i18n.mdx | 10 ++++---- .../docs/it/reference/configuration.md | 4 ++-- docs/src/content/docs/ja/guides/i18n.mdx | 10 ++++---- .../docs/ja/reference/configuration.md | 4 ++-- docs/src/content/docs/ko/guides/i18n.mdx | 10 ++++---- .../docs/ko/reference/configuration.md | 4 ++-- .../content/docs/ko/reference/overrides.md | 2 +- docs/src/content/docs/pt-br/guides/i18n.mdx | 10 ++++---- .../docs/pt-br/reference/configuration.md | 4 ++-- .../content/docs/reference/configuration.md | 4 ++-- docs/src/content/docs/reference/overrides.md | 2 +- docs/src/content/docs/{zh => zh-cn}/404.md | 2 +- .../{zh => zh-cn}/environmental-impact.md | 0 .../docs/{zh => zh-cn}/getting-started.mdx | 6 ++--- .../{zh => zh-cn}/guides/authoring-content.md | 8 +++---- .../docs/{zh => zh-cn}/guides/components.mdx | 12 +++++----- .../{zh => zh-cn}/guides/css-and-tailwind.mdx | 0 .../{zh => zh-cn}/guides/customization.mdx | 16 ++++++------- .../docs/{zh => zh-cn}/guides/i18n.mdx | 12 +++++----- .../guides/overriding-components.md | 16 ++++++------- .../guides/project-structure.mdx | 2 +- .../docs/{zh => zh-cn}/guides/sidebar.mdx | 24 +++++++++---------- docs/src/content/docs/{zh => zh-cn}/index.mdx | 2 +- .../docs/{zh => zh-cn}/manual-setup.mdx | 6 ++--- .../{zh => zh-cn}/reference/configuration.md | 12 +++++----- .../{zh => zh-cn}/reference/frontmatter.md | 18 +++++++------- .../docs/{zh => zh-cn}/reference/overrides.md | 14 +++++------ .../content/docs/{zh => zh-cn}/showcase.mdx | 0 packages/starlight/translations/index.ts | 2 +- .../translations/{zh.json => zh-CN.json} | 0 41 files changed, 140 insertions(+), 139 deletions(-) rename docs/src/content/docs/{zh => zh-cn}/404.md (93%) rename docs/src/content/docs/{zh => zh-cn}/environmental-impact.md (100%) rename docs/src/content/docs/{zh => zh-cn}/getting-started.mdx (89%) rename docs/src/content/docs/{zh => zh-cn}/guides/authoring-content.md (96%) rename docs/src/content/docs/{zh => zh-cn}/guides/components.mdx (94%) rename docs/src/content/docs/{zh => zh-cn}/guides/css-and-tailwind.mdx (100%) rename docs/src/content/docs/{zh => zh-cn}/guides/customization.mdx (92%) rename docs/src/content/docs/{zh => zh-cn}/guides/i18n.mdx (95%) rename docs/src/content/docs/{zh => zh-cn}/guides/overriding-components.md (82%) rename docs/src/content/docs/{zh => zh-cn}/guides/project-structure.mdx (94%) rename docs/src/content/docs/{zh => zh-cn}/guides/sidebar.mdx (92%) rename docs/src/content/docs/{zh => zh-cn}/index.mdx (98%) rename docs/src/content/docs/{zh => zh-cn}/manual-setup.mdx (92%) rename docs/src/content/docs/{zh => zh-cn}/reference/configuration.md (95%) rename docs/src/content/docs/{zh => zh-cn}/reference/frontmatter.md (82%) rename docs/src/content/docs/{zh => zh-cn}/reference/overrides.md (94%) rename docs/src/content/docs/{zh => zh-cn}/showcase.mdx (100%) rename packages/starlight/translations/{zh.json => zh-CN.json} (100%) diff --git a/.github/labeler.yml b/.github/labeler.yml index c7d5f4445e9..f1c10513a92 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -9,7 +9,7 @@ i18n: - docs/src/content/docs/fr/**/* - docs/src/content/docs/it/**/* - docs/src/content/docs/ja/**/* - - docs/src/content/docs/zh/**/* + - docs/src/content/docs/zh-cn/**/* - docs/src/content/docs/pt-br/**/* - docs/src/content/docs/ko/**/* - docs/src/content/docs/ru/**/* diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index d275e25c656..857d5c732b9 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -9,7 +9,7 @@ export const locales = { fr: { label: 'Français', lang: 'fr' }, it: { label: 'Italiano', lang: 'it' }, id: { label: 'Bahasa Indonesia', lang: 'id' }, - zh: { label: '简体中文', lang: 'zh' }, + 'zh-cn': { label: '简体中文', lang: 'zh-CN' }, 'pt-br': { label: 'Português do Brasil', lang: 'pt-BR' }, ko: { label: '한국어', lang: 'ko' }, ru: { label: 'Русский', lang: 'ru' }, @@ -64,7 +64,7 @@ export default defineConfig({ fr: 'Commencez ici', it: 'Inizia qui', id: 'Mulai dari sini', - zh: '从这里开始', + 'zh-CN': '从这里开始', 'pt-BR': 'Comece Aqui', ko: '여기서부터', ru: 'Начать отсюда', @@ -80,7 +80,7 @@ export default defineConfig({ fr: 'Mise en route', it: 'Iniziamo', id: 'Memulai', - zh: '开始使用', + 'zh-CN': '开始使用', 'pt-BR': 'Introdução', ko: '시작하기', ru: 'Введение', @@ -96,7 +96,7 @@ export default defineConfig({ fr: 'Installation manuelle', // it: 'Manual Setup', id: 'Instalasi Manual', - zh: '手动配置', + 'zh-CN': '手动配置', 'pt-BR': 'Instalação Manual', ko: '수동으로 설정하기', ru: 'Установка вручную', @@ -112,7 +112,7 @@ export default defineConfig({ fr: 'Impact environnemental', it: 'Impatto ambientale', id: 'Dampak terhadap lingkungan', - zh: '环境影响', + 'zh-CN': '环境影响', 'pt-BR': 'Impacto Ambiental', ko: '환경적 영향', ru: 'Влияние на окружающую среду', @@ -143,7 +143,7 @@ export default defineConfig({ fr: 'Guides', it: 'Guide', id: 'Petunjuk Penggunaan', - zh: '指南', + 'zh-CN': '指南', 'pt-BR': 'Guias', ko: '가이드', ru: 'Руководства', @@ -159,7 +159,7 @@ export default defineConfig({ fr: 'Référence', it: 'Riferimenti', id: 'Referensi', - zh: '参考', + 'zh-CN': '参考', 'pt-BR': 'Referência', ko: '참조', ru: 'Справочник', diff --git a/docs/package.json b/docs/package.json index 4315f90deaf..34ecd356744 100644 --- a/docs/package.json +++ b/docs/package.json @@ -5,7 +5,7 @@ "version": "0.0.1", "scripts": { "test": "start-server-and-test 'pnpm preview' http://localhost:4321 'pnpm pa11y'", - "pa11y": "pa11y-ci --sitemap 'http://localhost:4321/sitemap-0.xml' --sitemap-find 'https://starlight.astro.build' --sitemap-replace 'http://localhost:4321' --sitemap-exclude '/(de|zh|fr|es|pt-br|it|id|ko|ru)/.*'", + "pa11y": "pa11y-ci --sitemap 'http://localhost:4321/sitemap-0.xml' --sitemap-find 'https://starlight.astro.build' --sitemap-replace 'http://localhost:4321' --sitemap-exclude '/(de|zh-cn|fr|es|pt-br|it|id|ko|ru)/.*'", "dev": "astro dev", "start": "astro dev", "build": "astro build", diff --git a/docs/public/_redirects b/docs/public/_redirects index 3d094687795..a7aa40820f3 100644 --- a/docs/public/_redirects +++ b/docs/public/_redirects @@ -1,2 +1,3 @@ /ph/* https://astro-houston-ph.pages.dev/ph/:splat 200 +/zh/* /zh-cn/:splat /:lang/* /:lang/404/ 404 diff --git a/docs/src/content/docs/de/reference/configuration.md b/docs/src/content/docs/de/reference/configuration.md index de88c323a74..a7a4f17cf3d 100644 --- a/docs/src/content/docs/de/reference/configuration.md +++ b/docs/src/content/docs/de/reference/configuration.md @@ -217,8 +217,8 @@ export default defineConfig({ en: { label: 'English', }, - // Chinesische Seiten in `src/content/docs/zh/` - zh: { + // Chinesische Seiten in `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, diff --git a/docs/src/content/docs/es/guides/i18n.mdx b/docs/src/content/docs/es/guides/i18n.mdx index eb5bb62d546..aab6d33e21a 100644 --- a/docs/src/content/docs/es/guides/i18n.mdx +++ b/docs/src/content/docs/es/guides/i18n.mdx @@ -27,8 +27,8 @@ Starlight proporciona soporte incorporado para sitios multilingües, incluidas l en: { label: 'English', }, - // Chino simplificado en `src/content/docs/zh/` - zh: { + // Chino simplificado en `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -55,7 +55,7 @@ Starlight proporciona soporte incorporado para sitios multilingües, incluidas l - docs/ - ar/ - en/ - - zh/ + - zh-cn/ @@ -84,7 +84,7 @@ export default defineConfig({ label: 'English', lang: 'en', // lang es obligatorio para los locales raíz }, - zh: { + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -102,7 +102,7 @@ Cuando uses una `root` locale, mantén las páginas para ese idioma directamente - content/ - docs/ - **index.md** - - zh/ + - zh-cn/ - **index.md** diff --git a/docs/src/content/docs/es/reference/configuration.md b/docs/src/content/docs/es/reference/configuration.md index 362c45b5d80..fbfffe2510e 100644 --- a/docs/src/content/docs/es/reference/configuration.md +++ b/docs/src/content/docs/es/reference/configuration.md @@ -231,8 +231,8 @@ export default defineConfig({ en: { label: 'English', }, - // Los documentos en chino simplificado en `src/content/docs/zh/` - zh: { + // Los documentos en chino simplificado en `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, diff --git a/docs/src/content/docs/es/reference/overrides.md b/docs/src/content/docs/es/reference/overrides.md index 0cf193cb022..3aad36a2f61 100644 --- a/docs/src/content/docs/es/reference/overrides.md +++ b/docs/src/content/docs/es/reference/overrides.md @@ -42,7 +42,7 @@ La dirección de escritura de la página. **Tipo:** `string` -Etiqueta de idioma BCP-47 para la configuración regional de esta página, por ejemplo, `en`, `zh` o `pt-BR`. +Etiqueta de idioma BCP-47 para la configuración regional de esta página, por ejemplo, `en`, `zh-CN` o `pt-BR`. #### `locale` diff --git a/docs/src/content/docs/fr/guides/i18n.mdx b/docs/src/content/docs/fr/guides/i18n.mdx index 28c95118fbd..ba27a2d32cf 100644 --- a/docs/src/content/docs/fr/guides/i18n.mdx +++ b/docs/src/content/docs/fr/guides/i18n.mdx @@ -27,8 +27,8 @@ Starlight offre une prise en charge intégrée des sites multilingues, y compris en: { label: 'English', }, - // Docs en chinois simplifié dans `src/content/docs/zh/` - zh: { + // Docs en chinois simplifié dans `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -55,7 +55,7 @@ Starlight offre une prise en charge intégrée des sites multilingues, y compris - docs/ - ar/ - en/ - - zh/ + - zh-cn/ @@ -84,7 +84,7 @@ export default defineConfig({ label: 'English', lang: 'en', // lang est nécessaire pour les locales de la racine }, - zh: { + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -102,7 +102,7 @@ Lorsque vous utilisez une locale `root`, gardez les pages pour cette langue dire - content/ - docs/ - **index.md** - - zh/ + - zh-cn/ - **index.md** diff --git a/docs/src/content/docs/fr/reference/configuration.md b/docs/src/content/docs/fr/reference/configuration.md index 41596c87e70..e8cb8e70de3 100644 --- a/docs/src/content/docs/fr/reference/configuration.md +++ b/docs/src/content/docs/fr/reference/configuration.md @@ -230,8 +230,8 @@ export default defineConfig({ en: { label: 'English', }, - // Documentations en Chinois simplifié se trouve dans `src/content/docs/zh/` - zh: { + // Documentations en Chinois simplifié se trouve dans `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, diff --git a/docs/src/content/docs/guides/i18n.mdx b/docs/src/content/docs/guides/i18n.mdx index 0819703e2e9..2020256943c 100644 --- a/docs/src/content/docs/guides/i18n.mdx +++ b/docs/src/content/docs/guides/i18n.mdx @@ -27,8 +27,8 @@ Starlight provides built-in support for multilingual sites, including routing, f en: { label: 'English', }, - // Simplified Chinese docs in `src/content/docs/zh/` - zh: { + // Simplified Chinese docs in `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -55,7 +55,7 @@ Starlight provides built-in support for multilingual sites, including routing, f - docs/ - ar/ - en/ - - zh/ + - zh-cn/ @@ -84,7 +84,7 @@ export default defineConfig({ label: 'English', lang: 'en', // lang is required for root locales }, - zh: { + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -102,7 +102,7 @@ When using a `root` locale, keep pages for that language directly in `src/conten - content/ - docs/ - **index.md** - - zh/ + - zh-cn/ - **index.md** diff --git a/docs/src/content/docs/it/guides/i18n.mdx b/docs/src/content/docs/it/guides/i18n.mdx index c9ce07965e1..0e5f9130570 100644 --- a/docs/src/content/docs/it/guides/i18n.mdx +++ b/docs/src/content/docs/it/guides/i18n.mdx @@ -27,8 +27,8 @@ Starlight offre il supporto per siti multilingua, compreso di indirizzamento, co en: { label: 'English', }, - // La documentazione in cinese semplificato si trova in `src/content/docs/zh/` - zh: { + // La documentazione in cinese semplificato si trova in `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -55,7 +55,7 @@ Starlight offre il supporto per siti multilingua, compreso di indirizzamento, co - docs/ - ar/ - en/ - - zh/ + - zh-cn/ @@ -84,7 +84,7 @@ export default defineConfig({ label: 'English', lang: 'en', // necessario per root }, - zh: { + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -102,7 +102,7 @@ Quando si usa una lingua `root`, metti le pagine direttamente in `src/content/do - content/ - docs/ - **index.md** - - zh/ + - zh-cn/ - **index.md** diff --git a/docs/src/content/docs/it/reference/configuration.md b/docs/src/content/docs/it/reference/configuration.md index 950e7cf0106..b3c302abaca 100644 --- a/docs/src/content/docs/it/reference/configuration.md +++ b/docs/src/content/docs/it/reference/configuration.md @@ -229,8 +229,8 @@ export default defineConfig({ en: { label: 'English', }, - // La documentazione in cinese semplificato si trova in `src/content/docs/zh/` - zh: { + // La documentazione in cinese semplificato si trova in `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, diff --git a/docs/src/content/docs/ja/guides/i18n.mdx b/docs/src/content/docs/ja/guides/i18n.mdx index e0ae32fc525..48c500cbd48 100644 --- a/docs/src/content/docs/ja/guides/i18n.mdx +++ b/docs/src/content/docs/ja/guides/i18n.mdx @@ -27,8 +27,8 @@ Starlightは、ルーティング、フォールバックコンテンツ、右 en: { label: 'English', }, - // 簡体字中国語のドキュメントは`src/content/docs/zh/`に置きます。 - zh: { + // 簡体字中国語のドキュメントは`src/content/docs/zh-cn/`に置きます。 + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -54,7 +54,7 @@ Starlightは、ルーティング、フォールバックコンテンツ、右 - docs/ - ar/ - en/ - - zh/ + - zh-cn/ @@ -83,7 +83,7 @@ export default defineConfig({ label: 'English', lang: 'en', // langはルートロケールに必要です }, - zh: { + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -101,7 +101,7 @@ export default defineConfig({ - content/ - docs/ - **index.md** - - zh/ + - zh-cn/ - **index.md** diff --git a/docs/src/content/docs/ja/reference/configuration.md b/docs/src/content/docs/ja/reference/configuration.md index 6f492af38ce..0e8a54e1bf1 100644 --- a/docs/src/content/docs/ja/reference/configuration.md +++ b/docs/src/content/docs/ja/reference/configuration.md @@ -226,8 +226,8 @@ export default defineConfig({ en: { label: 'English', }, - // 簡体字中国語のドキュメントは`src/content/docs/zh/`にあります。 - zh: { + // 簡体字中国語のドキュメントは`src/content/docs/zh-cn/`にあります。 + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, diff --git a/docs/src/content/docs/ko/guides/i18n.mdx b/docs/src/content/docs/ko/guides/i18n.mdx index 08dc9f07e7f..5a1bfde0b1e 100644 --- a/docs/src/content/docs/ko/guides/i18n.mdx +++ b/docs/src/content/docs/ko/guides/i18n.mdx @@ -27,8 +27,8 @@ Starlight는 라우팅, 대체 콘텐츠 및 전체 RTL(오른쪽에서 왼쪽 en: { label: 'English', }, - // 중국어 간체 문서는 `src/content/docs/zh/`에 있습니다. - zh: { + // 중국어 간체 문서는 `src/content/docs/zh-cn/`에 있습니다. + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -54,7 +54,7 @@ Starlight는 라우팅, 대체 콘텐츠 및 전체 RTL(오른쪽에서 왼쪽 - docs/ - ar/ - en/ - - zh/ + - zh-cn/ @@ -83,7 +83,7 @@ export default defineConfig({ label: 'English', lang: 'en', // 루트 로케일은 lang이 반드시 필요합니다. }, - zh: { + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -101,7 +101,7 @@ export default defineConfig({ - content/ - docs/ - **index.md** - - zh/ + - zh-cn/ - **index.md** diff --git a/docs/src/content/docs/ko/reference/configuration.md b/docs/src/content/docs/ko/reference/configuration.md index 1088a02f547..c909f8dcfa5 100644 --- a/docs/src/content/docs/ko/reference/configuration.md +++ b/docs/src/content/docs/ko/reference/configuration.md @@ -233,8 +233,8 @@ export default defineConfig({ label: 'English', lang: 'en', }, - // 중국어 간체 문서는 `src/content/docs/zh/`에 있습니다. - zh: { + // 중국어 간체 문서는 `src/content/docs/zh-cn/`에 있습니다. + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, diff --git a/docs/src/content/docs/ko/reference/overrides.md b/docs/src/content/docs/ko/reference/overrides.md index 0026824ac20..d3f434a801a 100644 --- a/docs/src/content/docs/ko/reference/overrides.md +++ b/docs/src/content/docs/ko/reference/overrides.md @@ -39,7 +39,7 @@ Starlight는 사용자 정의 컴포넌트에 다음 속성들을 전달합니 **타입:** `string` -이 페이지의 로케일에 대한 BCP-47 언어 태그입니다. 예: `en`, `zh` 또는 `pt-BR` +이 페이지의 로케일에 대한 BCP-47 언어 태그입니다. 예: `en`, `zh-CN` 또는 `pt-BR` #### `locale` diff --git a/docs/src/content/docs/pt-br/guides/i18n.mdx b/docs/src/content/docs/pt-br/guides/i18n.mdx index 2f004eb5cc7..10d24590752 100644 --- a/docs/src/content/docs/pt-br/guides/i18n.mdx +++ b/docs/src/content/docs/pt-br/guides/i18n.mdx @@ -27,8 +27,8 @@ Starlight providencia suporte integrado para sites multilíngue, incluindo rotea pt: { label: 'Português', }, - // Documentação em Chinês Simplificado em `src/content/docs/zh/` - zh: { + // Documentação em Chinês Simplificado em `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -55,7 +55,7 @@ Starlight providencia suporte integrado para sites multilíngue, incluindo rotea - docs/ - ar/ - pt/ - - zh/ + - zh-cn/ @@ -84,7 +84,7 @@ export default defineConfig({ label: 'Português', lang: 'pt', // lang é obrigatório para locais raiz }, - zh: { + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -102,7 +102,7 @@ Ao utilizar um local `root`, mantenha as páginas para aquela língua diretament - content/ - docs/ - **index.md** - - zh/ + - zh-cn/ - **index.md** diff --git a/docs/src/content/docs/pt-br/reference/configuration.md b/docs/src/content/docs/pt-br/reference/configuration.md index 3402b754fcf..2d9ce8b7e2f 100644 --- a/docs/src/content/docs/pt-br/reference/configuration.md +++ b/docs/src/content/docs/pt-br/reference/configuration.md @@ -229,8 +229,8 @@ export default defineConfig({ en: { label: 'English', }, - // Documentação em Chinês Simplificado em `src/content/docs/zh/` - zh: { + // Documentação em Chinês Simplificado em `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, diff --git a/docs/src/content/docs/reference/configuration.md b/docs/src/content/docs/reference/configuration.md index b392f7f5144..9cd51a22a17 100644 --- a/docs/src/content/docs/reference/configuration.md +++ b/docs/src/content/docs/reference/configuration.md @@ -230,8 +230,8 @@ export default defineConfig({ en: { label: 'English', }, - // Simplified Chinese docs in `src/content/docs/zh/` - zh: { + // Simplified Chinese docs in `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, diff --git a/docs/src/content/docs/reference/overrides.md b/docs/src/content/docs/reference/overrides.md index 6b2ea2c42b0..e339b3ae51c 100644 --- a/docs/src/content/docs/reference/overrides.md +++ b/docs/src/content/docs/reference/overrides.md @@ -41,7 +41,7 @@ Page writing direction. **Type:** `string` -BCP-47 language tag for this page’s locale, e.g. `en`, `zh`, or `pt-BR`. +BCP-47 language tag for this page’s locale, e.g. `en`, `zh-CN`, or `pt-BR`. #### `locale` diff --git a/docs/src/content/docs/zh/404.md b/docs/src/content/docs/zh-cn/404.md similarity index 93% rename from docs/src/content/docs/zh/404.md rename to docs/src/content/docs/zh-cn/404.md index c72eb160ec4..a9ca63e38f5 100644 --- a/docs/src/content/docs/zh/404.md +++ b/docs/src/content/docs/zh-cn/404.md @@ -8,6 +8,6 @@ hero: actions: - text: 返回首页 icon: right-arrow - link: /zh/ + link: /zh-cn/ variant: primary --- diff --git a/docs/src/content/docs/zh/environmental-impact.md b/docs/src/content/docs/zh-cn/environmental-impact.md similarity index 100% rename from docs/src/content/docs/zh/environmental-impact.md rename to docs/src/content/docs/zh-cn/environmental-impact.md diff --git a/docs/src/content/docs/zh/getting-started.mdx b/docs/src/content/docs/zh-cn/getting-started.mdx similarity index 89% rename from docs/src/content/docs/zh/getting-started.mdx rename to docs/src/content/docs/zh-cn/getting-started.mdx index 0ac93fb94d5..590c93ddf02 100644 --- a/docs/src/content/docs/zh/getting-started.mdx +++ b/docs/src/content/docs/zh-cn/getting-started.mdx @@ -38,7 +38,7 @@ yarn create astro --template starlight -这将创建一个新的 [项目目录](/zh/guides/project-structure/),其中包含你网站所需的所有文件和配置。 +这将创建一个新的 [项目目录](/zh-cn/guides/project-structure/),其中包含你网站所需的所有文件和配置。 :::tip[查看实际效果] 在浏览器中尝试 Starlight: @@ -64,7 +64,7 @@ src/content/docs/guides/faq.md => your-site.com/guides/faq ### 类型安全的 frontmatter -所有 Starlight 页面都共享一个可自定义的 [frontmatter 属性集](/zh/reference/frontmatter/),用于控制页面的外观: +所有 Starlight 页面都共享一个可自定义的 [frontmatter 属性集](/zh-cn/reference/frontmatter/),用于控制页面的外观: ```md --- @@ -120,7 +120,7 @@ yarn upgrade @astrojs/starlight --latest ## Starlight 故障排除 -本站点的参考部分提供了 Starlight [项目配置](/zh/reference/configuration/)和[单个页面 frontmatter 配置](/zh/reference/frontmatter/)信息。使用这些页面来确保你的 Starlight 网站已正确配置和运行。 +本站点的参考部分提供了 Starlight [项目配置](/zh-cn/reference/configuration/)和[单个页面 frontmatter 配置](/zh-cn/reference/frontmatter/)信息。使用这些页面来确保你的 Starlight 网站已正确配置和运行。 请参阅侧边栏中不断增长的指南列表,以获取有关添加内容和自定义 Starlight 网站的帮助。 diff --git a/docs/src/content/docs/zh/guides/authoring-content.md b/docs/src/content/docs/zh-cn/guides/authoring-content.md similarity index 96% rename from docs/src/content/docs/zh/guides/authoring-content.md rename to docs/src/content/docs/zh-cn/guides/authoring-content.md index 68eec5bd39b..f2029a04578 100644 --- a/docs/src/content/docs/zh/guides/authoring-content.md +++ b/docs/src/content/docs/zh-cn/guides/authoring-content.md @@ -15,10 +15,10 @@ Starlight 支持在 `.md` 文件中使用完整的 [Markdown](https://daringfire 文本可以是**粗体**,_斜体_,或~~删除线~~。 ``` -你可以 [链接到另一个页面](/zh/getting-started/)。 +你可以 [链接到另一个页面](/zh-cn/getting-started/)。 ```md -你可以 [链接到另一个页面](/zh/getting-started/)。 +你可以 [链接到另一个页面](/zh-cn/getting-started/)。 ``` 你可以使用反引号高亮 `内联代码`。 @@ -146,7 +146,7 @@ Caution 和 danger 旁白有助于吸引用户注意可能绊倒他们的细节 - 清晰的导航 - 用户可配置的颜色主题 -- [i18n 支持](/zh/guides/i18n) +- [i18n 支持](/zh-cn/guides/i18n) ::: @@ -160,7 +160,7 @@ Caution 和 danger 旁白有助于吸引用户注意可能绊倒他们的细节 - 清晰的导航 - 用户可配置的颜色主题 -- [i18n 支持](/zh/guides/i18n) +- [i18n 支持](/zh-cn/guides/i18n) ::: ``` diff --git a/docs/src/content/docs/zh/guides/components.mdx b/docs/src/content/docs/zh-cn/guides/components.mdx similarity index 94% rename from docs/src/content/docs/zh/guides/components.mdx rename to docs/src/content/docs/zh-cn/guides/components.mdx index 7e2bc35370a..66082ba6bf8 100644 --- a/docs/src/content/docs/zh/guides/components.mdx +++ b/docs/src/content/docs/zh-cn/guides/components.mdx @@ -138,12 +138,12 @@ import { LinkCard, CardGrid } from '@astrojs/starlight/components'; - - + + ``` @@ -154,12 +154,12 @@ import { LinkCard } from '@astrojs/starlight/components'; - - + + ### 图标 diff --git a/docs/src/content/docs/zh/guides/css-and-tailwind.mdx b/docs/src/content/docs/zh-cn/guides/css-and-tailwind.mdx similarity index 100% rename from docs/src/content/docs/zh/guides/css-and-tailwind.mdx rename to docs/src/content/docs/zh-cn/guides/css-and-tailwind.mdx diff --git a/docs/src/content/docs/zh/guides/customization.mdx b/docs/src/content/docs/zh-cn/guides/customization.mdx similarity index 92% rename from docs/src/content/docs/zh/guides/customization.mdx rename to docs/src/content/docs/zh-cn/guides/customization.mdx index bbc6707fcd4..4805b4e25b9 100644 --- a/docs/src/content/docs/zh/guides/customization.mdx +++ b/docs/src/content/docs/zh-cn/guides/customization.mdx @@ -25,7 +25,7 @@ Starlight 提供了合理的默认样式和功能,因此你可以快速开始 -2. 在 `astro.config.mjs` 中,将 logo 的路径添加到 Starlight 的 [`logo.src`](/zh/reference/configuration/#logo) 选项: +2. 在 `astro.config.mjs` 中,将 logo 的路径添加到 Starlight 的 [`logo.src`](/zh-cn/reference/configuration/#logo) 选项: ```js // astro.config.mjs @@ -103,8 +103,8 @@ export default defineConfig({ 默认情况下,Starlight 页面使用带有全局导航侧边栏和显示当前页面标题的目录的布局。 -你可以通过在页面的正文中设置 [`template: splash`](/zh/reference/frontmatter/#template) 来应用更宽的页面布局,而去除侧边栏。 -这对于主页面特别有效,你可以在本站点的[主页](/zh/)上看到它的效果。 +你可以通过在页面的正文中设置 [`template: splash`](/zh-cn/reference/frontmatter/#template) 来应用更宽的页面布局,而去除侧边栏。 +这对于主页面特别有效,你可以在本站点的[主页](/zh-cn/)上看到它的效果。 ```md --- @@ -187,7 +187,7 @@ defineConfig({ ## 社交链接 -Starlight 内置了对通过 Starlight 集成中的 [`social`](/zh/reference/configuration/#social) 选项将链接添加到网站标题的社交媒体帐户的支持。 +Starlight 内置了对通过 Starlight 集成中的 [`social`](/zh-cn/reference/configuration/#social) 选项将链接添加到网站标题的社交媒体帐户的支持。 目前,支持链接到 Bitbucket、Codeberg、CodePen、Discord、Email、Facebook、GitHub、GitLab、Gitter、Instagram、LinkedIn、Mastodon、Microsoft Teams、RSS、Stack Overflow、Telegram、Threads、Twitch、Twitter、X 和 YouTube。如果你需要支持其他服务,请在 GitHub 或 Discord 上告诉我们! @@ -213,7 +213,7 @@ export default defineConfig({ Starlight 可以在每个页面的页脚中显示“编辑此页”链接。这样读者就可以找到要编辑以改进你的文档的文件。特别是对于开源项目,这有助于鼓励社区的贡献。 -要启用编辑链接,请将 Starlight 集成配置中的 [`editLink.baseUrl`](/zh/reference/configuration/#editlink) 设置为用于编辑存储库的URL。`editLink.baseUrl` 的值将附加到当前页面的路径前面,形成完整的编辑链接。 +要启用编辑链接,请将 Starlight 集成配置中的 [`editLink.baseUrl`](/zh-cn/reference/configuration/#editlink) 设置为用于编辑存储库的URL。`editLink.baseUrl` 的值将附加到当前页面的路径前面,形成完整的编辑链接。 常见的模式包括: @@ -256,7 +256,7 @@ Starlight 网站默认显示一个简单的 404 页面。你可以通过向 `src -你可以在 404 页面中使用 Starlight 的所有页面布局和自定义技术。例如,默认的404页面在 frontmatter 中使用 [`splash`](#页面布局) 模板和 [`hero`](/zh/reference/frontmatter/#hero) 组件: +你可以在 404 页面中使用 Starlight 的所有页面布局和自定义技术。例如,默认的404页面在 frontmatter 中使用 [`splash`](#页面布局) 模板和 [`hero`](/zh-cn/reference/frontmatter/#hero) 组件: ```md --- @@ -390,7 +390,7 @@ hero: ### 使用字体 -要将设置好的字体应用于你的站点,请在[自定义 CSS 文件](/zh/guides/css-and-tailwind/#custom-css-styles)中使用所选字体的名称。例如,要在整个站点上覆盖 Starlight 的默认字体,请设置`--sl-font`自定义属性: +要将设置好的字体应用于你的站点,请在[自定义 CSS 文件](/zh-cn/guides/css-and-tailwind/#custom-css-styles)中使用所选字体的名称。例如,要在整个站点上覆盖 Starlight 的默认字体,请设置`--sl-font`自定义属性: ```css /* src/styles/custom.css */ @@ -410,4 +410,4 @@ main { } ``` -按照[自定义 CSS](/zh/guides/css-and-tailwind/#custom-css-styles)将样式添加到你的站点。 +按照[自定义 CSS](/zh-cn/guides/css-and-tailwind/#custom-css-styles)将样式添加到你的站点。 diff --git a/docs/src/content/docs/zh/guides/i18n.mdx b/docs/src/content/docs/zh-cn/guides/i18n.mdx similarity index 95% rename from docs/src/content/docs/zh/guides/i18n.mdx rename to docs/src/content/docs/zh-cn/guides/i18n.mdx index 353f7790f34..586bf78691d 100644 --- a/docs/src/content/docs/zh/guides/i18n.mdx +++ b/docs/src/content/docs/zh-cn/guides/i18n.mdx @@ -9,7 +9,7 @@ Starlight 提供了内置的多语言支持,包括路由、回退内容和完 ## 配置 i18n -1. 通过将 [`locales`](/reference/configuration/#locales) 和 [`defaultLocale`](/reference/configuration/#defaultlocale) 传递给 Starlight 集成,告诉 Starlight 你支持的语言: +1. 通过将 [`locales`](/zh-cn/reference/configuration/#locales) 和 [`defaultLocale`](/zh-cn/reference/configuration/#defaultlocale) 传递给 Starlight 集成,告诉 Starlight 你支持的语言: ```js // astro.config.mjs @@ -27,8 +27,8 @@ Starlight 提供了内置的多语言支持,包括路由、回退内容和完 en: { label: 'English', }, - // 简体中文文档在 `src/content/docs/zh/` 中。 - zh: { + // 简体中文文档在 `src/content/docs/zh-cn/` 中。 + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -54,7 +54,7 @@ Starlight 提供了内置的多语言支持,包括路由、回退内容和完 - docs/ - ar/ - en/ - - zh/ + - zh-cn/ @@ -83,7 +83,7 @@ export default defineConfig({ label: 'English', lang: 'en', // lang 是 root 语言必须的 }, - zh: { + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -101,7 +101,7 @@ export default defineConfig({ - content/ - docs/ - **index.md** - - zh/ + - zh-cn/ - **index.md** diff --git a/docs/src/content/docs/zh/guides/overriding-components.md b/docs/src/content/docs/zh-cn/guides/overriding-components.md similarity index 82% rename from docs/src/content/docs/zh/guides/overriding-components.md rename to docs/src/content/docs/zh-cn/guides/overriding-components.md index bc82b015fb9..083ff39bee6 100644 --- a/docs/src/content/docs/zh/guides/overriding-components.md +++ b/docs/src/content/docs/zh-cn/guides/overriding-components.md @@ -5,7 +5,7 @@ sidebar: badge: 新功能 --- -Starlight 的默认 UI 和配置选项被设计成能灵活地适用于各种内容。大部分 Starlight 的默认外观可以通过 [CSS](/zh/guides/css-and-tailwind/) 和 [配置选项](/zh/guides/customization/) 进行自定义。 +Starlight 的默认 UI 和配置选项被设计成能灵活地适用于各种内容。大部分 Starlight 的默认外观可以通过 [CSS](/zh-cn/guides/css-and-tailwind/) 和 [配置选项](/zh-cn/guides/customization/) 进行自定义。 当你的需求超出了默认提供的功能时,Starlight 支持使用你自己的自定义组件来扩展或重写(完全替换)它的默认组件。 @@ -13,16 +13,16 @@ Starlight 的默认 UI 和配置选项被设计成能灵活地适用于各种内 重写 Starlight 的默认组件在以下情况下很有用: -- 你想要修改 Starlight 的一部分 UI 的样式,但是无法通过使用[自定义 CSS](/zh/guides/css-and-tailwind/) 实现。 +- 你想要修改 Starlight 的一部分 UI 的样式,但是无法通过使用[自定义 CSS](/zh-cn/guides/css-and-tailwind/) 实现。 - 你想要修改 Starlight 的一部分 UI 的行为。 - 你想要在 Starlight 的现有 UI 旁边添加一些额外的 UI。 ## 如何重写 1. 选择你想要重写的 Starlight 组件。 - 你可以在[重写参考](/zh/reference/overrides/)中找到完整的组件列表。 + 你可以在[重写参考](/zh-cn/reference/overrides/)中找到完整的组件列表。 - 本示例将重写 Starlight 页面导航栏中的 [`SocialIcons`](/zh/reference/overrides/#socialicons) 组件。 + 本示例将重写 Starlight 页面导航栏中的 [`SocialIcons`](/zh-cn/reference/overrides/#socialicons) 组件。 2. 创建一个 Astro 组件来替换 Starlight 组件。 本示例渲染了一个联系方式链接。 @@ -36,7 +36,7 @@ Starlight 的默认 UI 和配置选项被设计成能灵活地适用于各种内 E-mail Me ``` -3. 在 `astro.config.mjs` 的 [`components`](/zh/reference/configuration/#components) 配置选项中告诉 Starlight 使用你的自定义组件: +3. 在 `astro.config.mjs` 的 [`components`](/zh-cn/reference/configuration/#components) 配置选项中告诉 Starlight 使用你的自定义组件: ```js {9-12} // astro.config.mjs @@ -83,7 +83,7 @@ import Default from '@astrojs/starlight/components/SocialIcons.astro'; 当重写 Starlight 组件时,你的自定义实现会接收一个标准的 `Astro.props` 对象,其中包含当前页面的所有数据。 这使得你可以使用这些值来控制你的组件模板的渲染方式。 -例如,你可以通过 `Astro.props.entry.data` 读取页面的 frontmatter 数据。在下面的示例中,一个 [`PageTitle`](/zh/reference/overrides/#pagetitle) 的替代组件使用它来显示当前页面的标题: +例如,你可以通过 `Astro.props.entry.data` 读取页面的 frontmatter 数据。在下面的示例中,一个 [`PageTitle`](/zh-cn/reference/overrides/#pagetitle) 的替代组件使用它来显示当前页面的标题: ```astro {5} "{title}" --- @@ -102,13 +102,13 @@ const { title } = Astro.props.entry.data; ``` -要了解更多关于可用的参数的信息,请参阅[重写参考](/zh/reference/overrides/#%E7%BB%84%E4%BB%B6%E5%8F%82%E6%95%B0)。 +要了解更多关于可用的参数的信息,请参阅[重写参考](/zh-cn/reference/overrides/#%E7%BB%84%E4%BB%B6%E5%8F%82%E6%95%B0)。 ### 仅在特定页面上重写 组件重写在所有页面上生效。但是,你可以使用 `Astro.props` 中的值来条件性渲染,决定何时显示你的自定义 UI,何时显示 Starlight 的默认 UI,甚至何时显示完全不同的内容。 -在下面的示例中,一个重写 [`Footer`](/zh/reference/overrides/#footer) 的组件只在首页上显示“Built with Starlight 🌟”,在其他页面上显示默认的页脚: +在下面的示例中,一个重写 [`Footer`](/zh-cn/reference/overrides/#footer) 的组件只在首页上显示“Built with Starlight 🌟”,在其他页面上显示默认的页脚: ```astro --- diff --git a/docs/src/content/docs/zh/guides/project-structure.mdx b/docs/src/content/docs/zh-cn/guides/project-structure.mdx similarity index 94% rename from docs/src/content/docs/zh/guides/project-structure.mdx rename to docs/src/content/docs/zh-cn/guides/project-structure.mdx index dfef0d5948a..608117b73a5 100644 --- a/docs/src/content/docs/zh/guides/project-structure.mdx +++ b/docs/src/content/docs/zh-cn/guides/project-structure.mdx @@ -12,7 +12,7 @@ Starlight 项目通常遵循与其他 Astro 项目相同的文件和目录结构 - `astro.config.mjs` — Astro 配置文件;包括 Starlight 集成和配置。 - `src/content/config.ts` — 内容集合配置文件;将 Starlight 的 frontmatter 模式添加到你的项目中。 - `src/content/docs/` — 内容文件。Starlight 将此目录中的每个 `.md`、`.mdx` 或 `.mdoc` 文件转换为站点上的一个页面。 -- `src/content/i18n/` (可选) — 支持[国际化](/guides/i18n/)的翻译数据。 +- `src/content/i18n/` (可选) — 支持[国际化](/zh-cn/guides/i18n/)的翻译数据。 - `src/` — 项目的其他源代码和文档(组件、样式、图像等)。 - `public/` — 静态资源(字体、网站图标、PDF 等)不会被 Astro 处理。 diff --git a/docs/src/content/docs/zh/guides/sidebar.mdx b/docs/src/content/docs/zh-cn/guides/sidebar.mdx similarity index 92% rename from docs/src/content/docs/zh/guides/sidebar.mdx rename to docs/src/content/docs/zh-cn/guides/sidebar.mdx index e6edb085b89..35fca8dd001 100644 --- a/docs/src/content/docs/zh/guides/sidebar.mdx +++ b/docs/src/content/docs/zh-cn/guides/sidebar.mdx @@ -51,7 +51,7 @@ import SidebarPreview from '../../../../components/sidebar-preview.astro'; ## 添加链接和链接分组 -要配置侧边栏 [链接](#链接) 和 [链接分组](#分组)(在可折叠的标题中),请在 `astro.config.mjs` 中使用 [`starlight.sidebar`](/zh/reference/configuration/#sidebar) 属性。 +要配置侧边栏 [链接](#链接) 和 [链接分组](#分组)(在可折叠的标题中),请在 `astro.config.mjs` 中使用 [`starlight.sidebar`](/zh-cn/reference/configuration/#sidebar) 属性。 结合使用链接和链接分组,你可以创建各种侧边栏布局。 @@ -63,7 +63,7 @@ import SidebarPreview from '../../../../components/sidebar-preview.astro'; starlight({ sidebar: [ // 指向 CSS & Styling 指南的链接 - { label: 'CSS & Styling', link: '/zh/guides/css-and-tailwind/' }, + { label: 'CSS & Styling', link: '/zh-cn/guides/css-and-tailwind/' }, // 指向 Astro 官网的外部链接 { label: 'Astro', link: 'https://astro.build/' }, ], @@ -74,7 +74,7 @@ starlight({ @@ -189,9 +189,9 @@ starlight({ #### 在 frontmatter 中自定义自动生成的链接 -在单个页面中使用 [`sidebar` frontmatter 字段](/zh/reference/frontmatter/#sidebar) 来自定义自动生成的链接。 +在单个页面中使用 [`sidebar` frontmatter 字段](/zh-cn/reference/frontmatter/#sidebar) 来自定义自动生成的链接。 -侧边栏 frontmatter 选项允许你设置 [自定义标签](/zh/reference/frontmatter/#label) 或者为链接添加 [徽章](/zh/reference/frontmatter/#badge),[隐藏](/zh/reference/frontmatter/#hidden) 侧边栏中的链接,或者定义 [自定义排序权重](/zh/reference/frontmatter/#order)。 +侧边栏 frontmatter 选项允许你设置 [自定义标签](/zh-cn/reference/frontmatter/#label) 或者为链接添加 [徽章](/zh-cn/reference/frontmatter/#badge),[隐藏](/zh-cn/reference/frontmatter/#hidden) 侧边栏中的链接,或者定义 [自定义排序权重](/zh-cn/reference/frontmatter/#order)。 ```md --- @@ -367,22 +367,22 @@ starlight({ { label: 'Guides', translations: { - zh: '指南', + 'zh-cn': '指南', }, items: [ { label: 'Components', translations: { - zh: '组件', + 'zh-cn': '组件', }, - link: '/zh/guides/components/', + link: '/zh-cn/guides/components/', }, { label: 'Internationalization (i18n)', translations: { - zh: '国际化 (i18n)', + 'zh-cn': '国际化 (i18n)', }, - link: '/zh/guides/i18n/', + link: '/zh-cn/guides/i18n/', }, ], }, @@ -397,8 +397,8 @@ starlight({ { label: '指南', items: [ - { label: '组件', link: '/zh/guides/components/' }, - { label: '国际化 (i18n)', link: '/zh/guides/i18n/' }, + { label: '组件', link: '/zh-cn/guides/components/' }, + { label: '国际化 (i18n)', link: '/zh-cn/guides/i18n/' }, ], }, ]} diff --git a/docs/src/content/docs/zh/index.mdx b/docs/src/content/docs/zh-cn/index.mdx similarity index 98% rename from docs/src/content/docs/zh/index.mdx rename to docs/src/content/docs/zh-cn/index.mdx index c4181a2676e..e31c7505179 100644 --- a/docs/src/content/docs/zh/index.mdx +++ b/docs/src/content/docs/zh-cn/index.mdx @@ -25,7 +25,7 @@ hero: - text: 开始使用 icon: right-arrow variant: primary - link: /zh/getting-started/ + link: /zh-cn/getting-started/ - text: 在 GitHub 上查看 icon: external link: https://github.com/withastro/starlight diff --git a/docs/src/content/docs/zh/manual-setup.mdx b/docs/src/content/docs/zh-cn/manual-setup.mdx similarity index 92% rename from docs/src/content/docs/zh/manual-setup.mdx rename to docs/src/content/docs/zh-cn/manual-setup.mdx index bf02d5c9134..4c1cef8f0e9 100644 --- a/docs/src/content/docs/zh/manual-setup.mdx +++ b/docs/src/content/docs/zh-cn/manual-setup.mdx @@ -5,7 +5,7 @@ description: 了解如何手动配置 Starlight 以将其添加到现有的 Astr import { Tabs, TabItem } from '@astrojs/starlight/components'; -创建新的 Starlight 站点的最快方法是使用 `create astro`,如[入门指南](/zh/getting-started/#创建一个新项目)所示。 +创建新的 Starlight 站点的最快方法是使用 `create astro`,如[入门指南](/zh-cn/getting-started/#创建一个新项目)所示。 如果你想将 Starlight 添加到现有的 Astro 项目中,本指南将解释如何操作。 ## 设置 Starlight @@ -58,7 +58,7 @@ export default defineConfig({ }); ``` -在 [Starlight 配置参考](/zh/reference/configuration/) 中查找所有可用选项。 +在 [Starlight 配置参考](/zh-cn/reference/configuration/) 中查找所有可用选项。 ### 配置内容集合 @@ -93,7 +93,7 @@ description: 通过 Starlight 构建的文档网站,了解有关我的项目 欢迎来到我的项目! ``` -Starlight 使用基于文件的路由,这意味着 `src/content/docs/` 中的每个 Markdown、MDX 或 Markdoc 文件都将变成你站点上的一个页面。前置元数据(上面示例中的 `title` 和 `description` 字段)可以更改每个页面的显示方式。在 [frontmatter 指南](/zh/reference/frontmatter/) 中查看所有可用选项。 +Starlight 使用基于文件的路由,这意味着 `src/content/docs/` 中的每个 Markdown、MDX 或 Markdoc 文件都将变成你站点上的一个页面。前置元数据(上面示例中的 `title` 和 `description` 字段)可以更改每个页面的显示方式。在 [frontmatter 指南](/zh-cn/reference/frontmatter/) 中查看所有可用选项。 ## 现有站点的提示 diff --git a/docs/src/content/docs/zh/reference/configuration.md b/docs/src/content/docs/zh-cn/reference/configuration.md similarity index 95% rename from docs/src/content/docs/zh/reference/configuration.md rename to docs/src/content/docs/zh-cn/reference/configuration.md index 91be5d19a4d..2417066d053 100644 --- a/docs/src/content/docs/zh/reference/configuration.md +++ b/docs/src/content/docs/zh-cn/reference/configuration.md @@ -208,7 +208,7 @@ interface BadgeConfig { **类型:** { \[dir: string\]: [LocaleConfig](#localeconfig) } -为你的网站设置支持的 `locales` 来[配置国际化(i18n)](/zh/guides/i18n/)。 +为你的网站设置支持的 `locales` 来[配置国际化(i18n)](/zh-cn/guides/i18n/)。 每个条目都应该使用该语言文件保存的目录作为 key。 @@ -228,8 +228,8 @@ export default defineConfig({ en: { label: 'English', }, - // 简体中文文档在 `src/content/docs/zh/` - zh: { + // 简体中文文档在 `src/content/docs/zh-cn/` + 'zh-cn': { label: '简体中文', lang: 'zh-CN', }, @@ -382,7 +382,7 @@ interface HeadConfig { 控制页脚是否显示页面上次更新的时间。 -默认情况下,此功能依赖于你的存储库的 Git 历史记录,并且在某些执行[浅克隆](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt)的部署平台上可能不准确。页面可以使用 [`lastUpdated` frontmatter 字段](/zh/reference/frontmatter/#lastupdated)覆盖此设置或基于 Git 的日期。 +默认情况下,此功能依赖于你的存储库的 Git 历史记录,并且在某些执行[浅克隆](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt)的部署平台上可能不准确。页面可以使用 [`lastUpdated` frontmatter 字段](/zh-cn/reference/frontmatter/#lastupdated)覆盖此设置或基于 Git 的日期。 ### `pagination` @@ -391,7 +391,7 @@ interface HeadConfig { 定义页脚是否应包含上一页和下一页的链接。 -页面可以使用 [`prev`](/zh/reference/frontmatter/#prev) 和 [`next`](/zh/reference/frontmatter/#next) frontmatter 字段覆盖此设置或链接文本和/或 URL。 +页面可以使用 [`prev`](/zh-cn/reference/frontmatter/#prev) 和 [`next`](/zh-cn/reference/frontmatter/#next) frontmatter 字段覆盖此设置或链接文本和/或 URL。 ### `favicon` @@ -449,4 +449,4 @@ starlight({ }); ``` -要查阅所有可覆盖的组件,请参阅[覆盖参考](/zh/reference/overrides/)。 +要查阅所有可覆盖的组件,请参阅[覆盖参考](/zh-cn/reference/overrides/)。 diff --git a/docs/src/content/docs/zh/reference/frontmatter.md b/docs/src/content/docs/zh-cn/reference/frontmatter.md similarity index 82% rename from docs/src/content/docs/zh/reference/frontmatter.md rename to docs/src/content/docs/zh-cn/reference/frontmatter.md index 03b7a1c5588..867c28ef970 100644 --- a/docs/src/content/docs/zh/reference/frontmatter.md +++ b/docs/src/content/docs/zh-cn/reference/frontmatter.md @@ -32,13 +32,13 @@ description: 了解更多关于此项目的信息。 **类型:** `string | boolean` -覆盖[全局 `editLink` 配置](/zh/reference/configuration/#editlink)。设置为 false 可禁用特定页面的 “编辑页面” 链接,或提供此页面内容可编辑的备用 URL。 +覆盖[全局 `editLink` 配置](/zh-cn/reference/configuration/#editlink)。设置为 false 可禁用特定页面的 “编辑页面” 链接,或提供此页面内容可编辑的备用 URL。 ### `head` -**类型:** [`HeadConfig[]`](/zh/reference/configuration/#headconfig) +**类型:** [`HeadConfig[]`](/zh-cn/reference/configuration/#headconfig) -你可以使用 `` frontmatter 字段向页面的``添加其他标签。这意味着你可以将自定义样式、元数据或其他标签添加到单个页面。类似于[全局 `head` 选项](/zh/reference/configuration/#head)。 +你可以使用 `` frontmatter 字段向页面的``添加其他标签。这意味着你可以将自定义样式、元数据或其他标签添加到单个页面。类似于[全局 `head` 选项](/zh-cn/reference/configuration/#head)。 ```md --- @@ -54,7 +54,7 @@ head: **类型:** `false | { minHeadingLevel?: number; maxHeadingLevel?: number; }` -覆盖[全局 `tableOfContents` 配置](/zh/reference/configuration/#tableofcontents)。自定义要包含的标题级别,或设置为 `false` 以在此页面上隐藏目录。 +覆盖[全局 `tableOfContents` 配置](/zh-cn/reference/configuration/#tableofcontents)。自定义要包含的标题级别,或设置为 `false` 以在此页面上隐藏目录。 ```md --- @@ -157,7 +157,7 @@ banner: **类型:** `Date | boolean` -覆盖[全局 `lastUpdated` 配置](/zh/reference/configuration/#lastupdated)。如果指定了日期,它必须是有效的 [YAML 时间戳](https://yaml.org/type/timestamp.html),并将覆盖存储在 Git 历史记录中的此页面的日期。 +覆盖[全局 `lastUpdated` 配置](/zh-cn/reference/configuration/#lastupdated)。如果指定了日期,它必须是有效的 [YAML 时间戳](https://yaml.org/type/timestamp.html),并将覆盖存储在 Git 历史记录中的此页面的日期。 ```md --- @@ -170,7 +170,7 @@ lastUpdated: 2022-08-09 **类型:** `boolean | string | { link?: string; label?: string }` -覆盖[全局 `pagination` 配置](/zh/reference/configuration/#pagination)。如果指定了字符串,则将替换生成的链接文本;如果指定了对象,则将同时覆盖链接和文本。 +覆盖[全局 `pagination` 配置](/zh-cn/reference/configuration/#pagination)。如果指定了字符串,则将替换生成的链接文本;如果指定了对象,则将同时覆盖链接和文本。 ```md --- @@ -226,7 +226,7 @@ pagefind: false **类型:** [`SidebarConfig`](#sidebarconfig) -在使用自动生成的链接分组时,控制如何在[侧边栏](/zh/reference/configuration/#sidebar)中显示此页面。 +在使用自动生成的链接分组时,控制如何在[侧边栏](/zh-cn/reference/configuration/#sidebar)中显示此页面。 #### `SidebarConfig` @@ -287,11 +287,11 @@ sidebar: #### `badge` -**类型:** string | BadgeConfig +**类型:** string | BadgeConfig 当在自动生成的链接组中显示时,在侧边栏中为页面添加徽章。 -当使用字符串时,徽章将显示为默认的强调色。可选择的,传递一个 [`BadgeConfig` 对象](/zh/reference/configuration/#badgeconfig) ,其中包含 `text` 和 `variant` 字段,可以自定义徽章。 +当使用字符串时,徽章将显示为默认的强调色。可选择的,传递一个 [`BadgeConfig` 对象](/zh-cn/reference/configuration/#badgeconfig) ,其中包含 `text` 和 `variant` 字段,可以自定义徽章。 ```md --- diff --git a/docs/src/content/docs/zh/reference/overrides.md b/docs/src/content/docs/zh-cn/reference/overrides.md similarity index 94% rename from docs/src/content/docs/zh/reference/overrides.md rename to docs/src/content/docs/zh-cn/reference/overrides.md index fa09f71bc25..0861ba67b93 100644 --- a/docs/src/content/docs/zh/reference/overrides.md +++ b/docs/src/content/docs/zh-cn/reference/overrides.md @@ -5,10 +5,10 @@ tableOfContents: maxHeadingLevel: 4 --- -你可以通过在 Starlight 的 [`components`](/zh/reference/configuration/#components) 配置选项中提供替代组件的路径来替换掉 (即重写) Starlight 的内置组件。 +你可以通过在 Starlight 的 [`components`](/zh-cn/reference/configuration/#components) 配置选项中提供替代组件的路径来替换掉 (即重写) Starlight 的内置组件。 本页面列出了所有可被重写的组件和它们默认实现的 GitHub 链接。 -在[重写组件指南](/zh/guides/overriding-components/)中了解更多。 +在[重写组件指南](/zh-cn/guides/overriding-components/)中了解更多。 ## 组件参数 @@ -41,7 +41,7 @@ Starlight 会将以下参数传递给你的自定义组件。 **类型:** `string` -当前页面的 BCP-47 语言标签,例如 `en`、`zh` 或 `pt-BR`。 +当前页面的 BCP-47 语言标签,例如 `en`、`zh-CN` 或 `pt-BR`。 #### `locale` @@ -151,7 +151,7 @@ entry: { 包含 `` 和 `<meta charset="utf-8">` 等重要标签。 重写此组件应作为最后手段。 -如果可能,请优先使用 Starlight 配置中的 [`head`](/zh/reference/configuration/#head) 选项。 +如果可能,请优先使用 Starlight 配置中的 [`head`](/zh-cn/reference/configuration/#head) 选项。 #### `ThemeProvider` @@ -232,7 +232,7 @@ entry: { **默认组件:** [`SocialIcons.astro`](https://github.com/withastro/starlight/blob/main/packages/starlight/components/SocialIcons.astro) 在导航栏中渲染的组件,用于渲染社交图标链接。 -默认实现使用 Starlight 配置中的 [`social`](/zh/reference/configuration/#social) 选项来渲染图标和链接。 +默认实现使用 Starlight 配置中的 [`social`](/zh-cn/reference/configuration/#social) 选项来渲染图标和链接。 #### `ThemeSelect` @@ -305,7 +305,7 @@ Starlight 的页面侧边栏负责显示当前页面的子标题的目录。 **默认组件:** [`Banner.astro`](https://github.com/withastro/starlight/blob/main/packages/starlight/components/Banner.astro) 横幅 (Banner) 组件在每个页面的顶部渲染。 -默认实现使用页面的 [`banner`](/zh/reference/frontmatter#banner) frontmatter 值来决定是否渲染。 +默认实现使用页面的 [`banner`](/zh-cn/reference/frontmatter#banner) frontmatter 值来决定是否渲染。 #### `ContentPanel` @@ -332,7 +332,7 @@ Starlight 的页面侧边栏负责显示当前页面的子标题的目录。 **默认组件:** [`Hero.astro`](https://github.com/withastro/starlight/blob/main/packages/starlight/components/Hero.astro) -当设置了 frontmatter 中的 [`hero`](/zh/reference/frontmatter#hero) 时在页面顶部渲染的组件。 +当设置了 frontmatter 中的 [`hero`](/zh-cn/reference/frontmatter#hero) 时在页面顶部渲染的组件。 默认实现显示了一个大标题、标语、动作链接 (call-to-action links) 和可选的图片。 #### `MarkdownContent` diff --git a/docs/src/content/docs/zh/showcase.mdx b/docs/src/content/docs/zh-cn/showcase.mdx similarity index 100% rename from docs/src/content/docs/zh/showcase.mdx rename to docs/src/content/docs/zh-cn/showcase.mdx diff --git a/packages/starlight/translations/index.ts b/packages/starlight/translations/index.ts index 37c2fd4dcf2..27cfec319dc 100644 --- a/packages/starlight/translations/index.ts +++ b/packages/starlight/translations/index.ts @@ -15,7 +15,7 @@ import da from './da.json'; import tr from './tr.json'; import ar from './ar.json'; import nb from './nb.json'; -import zh from './zh.json'; +import zh from './zh-CN.json'; import ko from './ko.json'; import sv from './sv.json'; import ru from './ru.json'; diff --git a/packages/starlight/translations/zh.json b/packages/starlight/translations/zh-CN.json similarity index 100% rename from packages/starlight/translations/zh.json rename to packages/starlight/translations/zh-CN.json From ec4d128c6c12b6a177c0e429fdb6fc57a9f29a8c Mon Sep 17 00:00:00 2001 From: Genteure <genteure@gmail.com> Date: Wed, 11 Oct 2023 23:09:46 +0800 Subject: [PATCH 2/4] i18n(zh-CN): fix link to astro main doc (#866) --- docs/src/content/docs/zh-cn/guides/overriding-components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/content/docs/zh-cn/guides/overriding-components.md b/docs/src/content/docs/zh-cn/guides/overriding-components.md index 083ff39bee6..68cf0740776 100644 --- a/docs/src/content/docs/zh-cn/guides/overriding-components.md +++ b/docs/src/content/docs/zh-cn/guides/overriding-components.md @@ -76,7 +76,7 @@ import Default from '@astrojs/starlight/components/SocialIcons.astro'; 在自定义组件中渲染内置组件时: - 展开传入 `Astro.props`。这样可以确保它接收到渲染所需的所有数据。 -- 在默认组件内部添加一个 [`<slot />`](https://docs.astro.build/en/core-concepts/astro-components/#slots)。这样,如果组件传入了任何子元素,Astro 就知道在哪里渲染它们。 +- 在默认组件内部添加一个 [`<slot />`](https://docs.astro.build/zh-cn/core-concepts/astro-components/#插槽)。这样,如果组件传入了任何子元素,Astro 就知道在哪里渲染它们。 ## 使用页面数据 From 87cef48635206688ddf7c675d8250d381c5d3964 Mon Sep 17 00:00:00 2001 From: Genteure <genteure@gmail.com> Date: Wed, 11 Oct 2023 23:19:58 +0800 Subject: [PATCH 3/4] i18n(zh-CN): fix another link to astro main doc (#867) --- docs/src/content/docs/zh-cn/getting-started.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/content/docs/zh-cn/getting-started.mdx b/docs/src/content/docs/zh-cn/getting-started.mdx index 590c93ddf02..d2d06db0cb9 100644 --- a/docs/src/content/docs/zh-cn/getting-started.mdx +++ b/docs/src/content/docs/zh-cn/getting-started.mdx @@ -51,7 +51,7 @@ Starlight 已经准备好让你添加新的内容,或者将你现有的文件 ### 文件格式 -Starlight 支持使用 Markdown 和 MDX 来编写内容。(你可以通过安装实验性的 [Astro Markdoc 集成](https://docs.astro.build/en/guides/integrations-guide/markdoc/) 来添加对 Markdoc 的支持。) +Starlight 支持使用 Markdown 和 MDX 来编写内容。(你可以通过安装实验性的 [Astro Markdoc 集成](https://docs.astro.build/zh-cn/guides/integrations-guide/markdoc/) 来添加对 Markdoc 的支持。) ### 添加页面 From f33be7f37f37afb2a5ec927e2f5b52caeb57412b Mon Sep 17 00:00:00 2001 From: Chris Swithinbank <swithinbank@gmail.com> Date: Wed, 11 Oct 2023 17:53:09 +0200 Subject: [PATCH 4/4] Add missing changeset from #852 Co-Authored-By: Loot N. <16526639+Lootjs@users.noreply.github.com> --- .changeset/hip-needles-tell.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/hip-needles-tell.md diff --git a/.changeset/hip-needles-tell.md b/.changeset/hip-needles-tell.md new file mode 100644 index 00000000000..97b63efc050 --- /dev/null +++ b/.changeset/hip-needles-tell.md @@ -0,0 +1,5 @@ +--- +'@astrojs/starlight': patch +--- + +Improve Russian language support