refactor: simplify documentation structure by removing multi-language i18n support and unused components

This commit is contained in:
Mathis HERRIOT
2026-01-05 10:16:29 +01:00
parent 91179199f7
commit 4d776c5c16
27 changed files with 57 additions and 445 deletions

View File

@@ -1,6 +1,6 @@
import { HomeLayout } from "fumadocs-ui/layouts/home";
import { baseOptions } from "@/lib/layout.shared";
export default function Layout({ children }: { children: React.ReactNode; params: Promise<{ lang: string }>}) {
export default function Layout({ children }: LayoutProps<"/">) {
return <HomeLayout {...baseOptions()}>{children}</HomeLayout>;
}

View File

@@ -6,7 +6,7 @@ export default function HomePage() {
<h1 className="text-2xl font-bold mb-4">Hello World</h1>
<p>
You can open{" "}
<Link href="/[lang]/docs" className="font-medium underline">
<Link href="/docs" className="font-medium underline">
/docs
</Link>{" "}
and see the documentation.

View File

@@ -1,38 +0,0 @@
import { RootProvider } from "fumadocs-ui/provider/next";
import "./global.css";
import { Inter } from "next/font/google";
import { defineI18nUI } from "fumadocs-ui/i18n";
import { i18n } from "@/lib/i18n";
const inter = Inter({
subsets: ["latin"],
});
const { provider } = defineI18nUI(i18n, {
translations: {
en: {
displayName: "English",
},
fr: {
displayName: "French",
},
},
});
export default async function RootLayout({
params,
children,
}: {
params: Promise<{ lang: string }>;
children: React.ReactNode;
}) {
const lang = (await params).lang;
return (
<html lang={lang}>
<body className={inter.className}>
<RootProvider i18n={provider(lang)}>{children}</RootProvider>
</body>
</html>
);
}

View File

@@ -2,8 +2,6 @@ import { source } from "@/lib/source";
import { createFromSource } from "fumadocs-core/search/server";
export const { GET } = createFromSource(source, {
localeMap: {
fr: { language: 'french' },
en: { language: 'english' },
},
// https://docs.orama.com/docs/orama-js/supported-languages
language: "english",
});

View File

@@ -10,9 +10,9 @@ import { getMDXComponents } from "@/mdx-components";
import type { Metadata } from "next";
import { createRelativeLink } from "fumadocs-ui/mdx";
export default async function Page(props: { params: Promise<{ lang: string; slug?: string[]; }> }) {
export default async function Page(props: PageProps<"/docs/[[...slug]]">) {
const params = await props.params;
const page = source.getPage(params.slug, params.lang);
const page = source.getPage(params.slug);
if (!page) notFound();
const MDX = page.data.body;
@@ -38,10 +38,10 @@ export async function generateStaticParams() {
}
export async function generateMetadata(
props: PageProps<"/docs/[[...slug]]"> & { params: Promise<{ lang: string; }> },
props: PageProps<"/docs/[[...slug]]">,
): Promise<Metadata> {
const params = await props.params;
const page = source.getPage(params.slug, params.lang);
const page = source.getPage(params.slug);
if (!page) notFound();
return {

View File

@@ -2,7 +2,7 @@ import { source } from "@/lib/source";
import { DocsLayout } from "fumadocs-ui/layouts/docs";
import { baseOptions } from "@/lib/layout.shared";
export default function Layout({ children }: { children: React.ReactNode }) {
export default function Layout({ children }: LayoutProps<"/docs">) {
return (
<DocsLayout tree={source.getPageTree()} {...baseOptions()}>
{children}

View File

@@ -0,0 +1,17 @@
import { RootProvider } from "fumadocs-ui/provider/next";
import "./global.css";
import { Inter } from "next/font/google";
const inter = Inter({
subsets: ["latin"],
});
export default function Layout({ children }: LayoutProps<"/">) {
return (
<html lang="en" className={inter.className} suppressHydrationWarning>
<body className="flex flex-col min-h-screen">
<RootProvider>{children}</RootProvider>
</body>
</html>
);
}

View File

@@ -17,7 +17,7 @@ export async function GET(
<DefaultImage
title={page.data.title}
description={page.data.description}
site="MemeGoat"
site="My App"
/>,
{
width: 1200,