feat(docs): enhance documentation site with internationalization and layout updates

- Updated the demo API to support locale-based content rendering.
- Refactored the main layout to accommodate language-specific metadata and routing.
- Introduced new components for blog and documentation pages, ensuring proper language handling.
- Added styles for improved UI consistency across different sections.
- Removed deprecated layout files and streamlined the structure for better maintainability.
This commit is contained in:
leookun
2026-08-28 00:35:31 +08:00
parent 6c758f2b44
commit eca063e424
55 changed files with 6700 additions and 407 deletions
+16 -8
View File
@@ -1,27 +1,35 @@
import { zhCN } from '@fumadocs/language/zh-cn';
import { defineTranslations } from 'fumadocs-core/i18n';
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
import { uiTranslations } from 'fumadocs-ui/i18n';
import { i18n, type Language } from './i18n';
import { appName, gitConfig, releaseUrl } from './shared';
export const translations = defineTranslations().extend(uiTranslations()).preset(zhCN());
export const translations = i18n.translations().extend(uiTranslations()).preset('zh', zhCN());
const navLabels: Record<Language, { docs: string; blog: string; download: string }> = {
zh: { docs: '文档', blog: '开发者博客', download: '下载' },
en: { docs: 'Docs', blog: 'Blog', download: 'Download' },
};
export function baseOptions(lang: Language): BaseLayoutProps {
const labels = navLabels[lang];
const prefix = lang === i18n.defaultLanguage ? '' : `/${lang}`;
export function baseOptions(): BaseLayoutProps {
return {
nav: {
title: appName,
},
links: [
{
text: '文档',
url: '/docs',
text: labels.docs,
url: `${prefix}/docs`,
},
{
text: '开发者博客',
url: '/blog',
text: labels.blog,
url: `${prefix}/blog`,
},
{
text: '下载',
text: labels.download,
url: releaseUrl,
external: true,
},