refactor: migrate documentation to support multi-language structure with i18n integration
Some checks failed
Documentation Lint / lint (push) Failing after 4m46s

This commit is contained in:
Mathis HERRIOT
2026-01-05 01:23:00 +01:00
parent c1acc9f16b
commit 91179199f7
38 changed files with 705 additions and 315 deletions

View File

@@ -0,0 +1,6 @@
import { defineI18n } from "fumadocs-core/i18n";
export const i18n = defineI18n({
defaultLanguage: "en",
languages: ["en", "fr"],
});

View File

@@ -1,9 +1,11 @@
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
import {i18n} from "@/lib/i18n";
export function baseOptions(): BaseLayoutProps {
return {
nav: {
title: 'My App',
},
};
return {
i18n,
nav: {
title: "MemeGoat",
},
};
}

View File

@@ -1,27 +1,29 @@
import { docs } from 'fumadocs-mdx:collections/server';
import { type InferPageType, loader } from 'fumadocs-core/source';
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
import { docs } from "fumadocs-mdx:collections/server";
import { type InferPageType, loader } from "fumadocs-core/source";
import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";
import {i18n} from "@/lib/i18n";
// See https://fumadocs.dev/docs/headless/source-api for more info
export const source = loader({
baseUrl: '/docs',
source: docs.toFumadocsSource(),
plugins: [lucideIconsPlugin()],
i18n,
baseUrl: "/docs",
source: docs.toFumadocsSource(),
plugins: [lucideIconsPlugin()],
});
export function getPageImage(page: InferPageType<typeof source>) {
const segments = [...page.slugs, 'image.png'];
const segments = [...page.slugs, "image.png"];
return {
segments,
url: `/og/docs/${segments.join('/')}`,
};
return {
segments,
url: `/og/docs/${segments.join("/")}`,
};
}
export async function getLLMText(page: InferPageType<typeof source>) {
const processed = await page.data.getText('processed');
const processed = await page.data.getText("processed");
return `# ${page.data.title}
return `# ${page.data.title}
${processed}`;
}