/** * scripts/generate-docs/lib/i18n-types.ts * * The two languages of the docs site and the shapes that carry both. */ import type { LocalisedString } from './markdown-parser'; export type Lang = 'fr' | 'en'; export interface Localised { fr: string; en: string; } /** A frontmatter / sidebar value (one string, or `{ fr, en }`) as both languages. */ export function localise(value: LocalisedString | undefined): Localised { if (value == null) return { fr: '', en: '' }; if (typeof value === 'string') return { fr: value, en: value }; return { fr: value.fr ?? '', en: value.en ?? value.fr ?? '' }; }