Files
cursor-byok/apps/docs/lib/layout.shared.tsx
T
leookun eca063e424 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.
2026-08-28 00:35:31 +08:00

40 lines
1.1 KiB
TypeScript

import { zhCN } from '@fumadocs/language/zh-cn';
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 = 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}`;
return {
nav: {
title: appName,
},
links: [
{
text: labels.docs,
url: `${prefix}/docs`,
},
{
text: labels.blog,
url: `${prefix}/blog`,
},
{
text: labels.download,
url: releaseUrl,
external: true,
},
],
githubUrl: `https://github.com/${gitConfig.user}/${gitConfig.repo}`,
};
}