diff --git a/apps/outreach/astro.config.ts b/apps/outreach/astro.config.ts index 99ff2d39a..1aedfac29 100644 --- a/apps/outreach/astro.config.ts +++ b/apps/outreach/astro.config.ts @@ -70,7 +70,8 @@ export default defineConfig({ output: 'runtime-core-docs', sidebar: { collapsed: true, - label: 'Runtime Core API' + label: 'Runtime Core API', + translations: { fr: 'API de Runtime Core' } }, tsconfig: path.resolve(runtimeCoreRoot, 'tsconfig.json') }) @@ -82,7 +83,8 @@ export default defineConfig({ }, { autogenerate: { directory: 'docs/2-tutorials' }, - label: 'Tutorials' + label: 'Tutorials', + translations: { fr: 'Tutoriels' } }, { autogenerate: { directory: 'docs/3-guides' }, @@ -94,11 +96,13 @@ export default defineConfig({ }, { autogenerate: { directory: 'docs/5-reference' }, - label: 'Reference' + label: 'Reference', + translations: { fr: 'Référence' } }, { label: 'Changelog', - slug: 'docs/changelog' + slug: 'docs/changelog', + translations: { fr: 'Journal des modifications' } }, starlightTypeDocSidebarGroup ], diff --git a/apps/outreach/src/plugins/starlight-plugin-typedoc/index.ts b/apps/outreach/src/plugins/starlight-plugin-typedoc/index.ts index eb47e903e..9398fbbaa 100644 --- a/apps/outreach/src/plugins/starlight-plugin-typedoc/index.ts +++ b/apps/outreach/src/plugins/starlight-plugin-typedoc/index.ts @@ -4,6 +4,8 @@ import type { TypeDocOptions } from 'typedoc'; import { getSidebarFromReflections, getSidebarGroupPlaceholder } from './starlight'; import { generateTypeDoc } from './typedoc'; +import type { SidebarTranslations } from './starlight'; + export type StarlightTypeDocSidebarOptions = { /** * Whether the generated documentation sidebar group should be collapsed by default. @@ -14,6 +16,10 @@ export type StarlightTypeDocSidebarOptions = { * The generated documentation sidebar group label. */ label: string; + /** + * The generated documentation sidebar group label, translated per locale. + */ + translations?: SidebarTranslations; }; export type StarlightTypeDocOptions = { diff --git a/apps/outreach/src/plugins/starlight-plugin-typedoc/starlight.ts b/apps/outreach/src/plugins/starlight-plugin-typedoc/starlight.ts index 008609dbf..5e76d9f11 100644 --- a/apps/outreach/src/plugins/starlight-plugin-typedoc/starlight.ts +++ b/apps/outreach/src/plugins/starlight-plugin-typedoc/starlight.ts @@ -31,7 +31,10 @@ export function getSidebarFromReflections( return sidebar; } - const sidebarGroup = getSidebarGroupFromReflections(options, reflections, baseOutputDirectory, baseOutputDirectory); + const sidebarGroup: SidebarGroup = { + ...getSidebarGroupFromReflections(options, reflections, baseOutputDirectory, baseOutputDirectory), + translations: options.translations + }; function replaceSidebarGroupPlaceholder(group: SidebarManualGroup): SidebarGroup { if (group.label === sidebarGroupPlaceholder.label) { @@ -238,8 +241,11 @@ export type SidebarGroup = }; collapsed?: boolean; label: string; + translations?: SidebarTranslations; }; +export type SidebarTranslations = { [locale: string]: string }; + type SidebarManualGroup = { badge?: | string @@ -251,6 +257,7 @@ type SidebarManualGroup = { collapsed?: boolean; items: (LinkItem | SidebarGroup)[]; label: string; + translations?: SidebarTranslations; }; type LinkItem = {