Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions apps/outreach/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
Expand All @@ -82,7 +83,8 @@ export default defineConfig({
},
{
autogenerate: { directory: 'docs/2-tutorials' },
label: 'Tutorials'
label: 'Tutorials',
translations: { fr: 'Tutoriels' }
},
{
autogenerate: { directory: 'docs/3-guides' },
Expand All @@ -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
],
Expand Down
6 changes: 6 additions & 0 deletions apps/outreach/src/plugins/starlight-plugin-typedoc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -238,8 +241,11 @@ export type SidebarGroup =
};
collapsed?: boolean;
label: string;
translations?: SidebarTranslations;
};

export type SidebarTranslations = { [locale: string]: string };

type SidebarManualGroup = {
badge?:
| string
Expand All @@ -251,6 +257,7 @@ type SidebarManualGroup = {
collapsed?: boolean;
items: (LinkItem | SidebarGroup)[];
label: string;
translations?: SidebarTranslations;
};

type LinkItem = {
Expand Down