Skip to content

Commit e1038ae

Browse files
Copilothotlong
andcommitted
Refactor language name mapping for better maintainability
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 243250e commit e1038ae

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/docs/app/[lang]/layout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import type { ReactNode } from 'react';
22
import { RootProvider } from 'fumadocs-ui/provider/next';
33
import { i18n } from '@/lib/i18n';
44

5+
// Language display names mapping
6+
const LANGUAGE_NAMES: Record<string, string> = {
7+
en: 'English',
8+
cn: '中文',
9+
};
10+
511
export default async function LanguageLayout({
612
params,
713
children,
@@ -18,7 +24,7 @@ export default async function LanguageLayout({
1824
i18n={{
1925
locale: lang,
2026
locales: i18n.languages.map((l) => ({
21-
name: l === 'en' ? 'English' : '中文',
27+
name: LANGUAGE_NAMES[l] || l,
2228
locale: l,
2329
})),
2430
}}

0 commit comments

Comments
 (0)