File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ export default async function Layout({
1414 const { lang } = await params ;
1515
1616 return (
17- < DocsLayout tree = { source . pageTree [ lang ] } { ...baseOptions } >
17+ < DocsLayout
18+ tree = { source . pageTree [ lang ] }
19+ { ...baseOptions }
20+ i18n
21+ >
1822 { children }
1923 </ DocsLayout >
2024 ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ import type { ReactNode } from 'react';
22import { RootProvider } from 'fumadocs-ui/provider/next' ;
33import { i18n } from '@/lib/i18n' ;
44
5+ // Language display names mapping
6+ const LANGUAGE_NAMES : Record < string , string > = {
7+ en : 'English' ,
8+ cn : '中文' ,
9+ } ;
10+
511export default async function LanguageLayout ( {
612 params,
713 children,
@@ -14,7 +20,17 @@ export default async function LanguageLayout({
1420 return (
1521 < html lang = { lang } suppressHydrationWarning >
1622 < body >
17- < RootProvider > { children } </ RootProvider >
23+ < RootProvider
24+ i18n = { {
25+ locale : lang ,
26+ locales : i18n . languages . map ( ( l ) => ( {
27+ name : LANGUAGE_NAMES [ l ] || l ,
28+ locale : l ,
29+ } ) ) ,
30+ } }
31+ >
32+ { children }
33+ </ RootProvider >
1834 </ body >
1935 </ html >
2036 ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { baseOptions } from '@/app/layout.config';
55
66export default function HomePage ( ) {
77 return (
8- < HomeLayout { ...baseOptions } >
8+ < HomeLayout { ...baseOptions } i18n >
99 < main className = "flex min-h-screen flex-col items-center justify-center text-center px-4 py-16 sm:py-24 md:py-32 overflow-hidden bg-background text-foreground selection:bg-primary/20" >
1010
1111 { /* Hero Section */ }
You can’t perform that action at this time.
0 commit comments