feat: update documentation and enhance internationalization support

- Commented out the <Cards> component in index.mdx and introduction.mdx for clarity.
- Added new translation entries for "homepage" and "title" in both English and Chinese message files.
- Refactored layout.tsx to include a new baseOptions configuration for improved layout management and theme support.
- Integrated ModeSwitcher and Logo components into the layout for enhanced user experience.
- Updated page.tsx to prepare for potential Mdx component integration.
This commit is contained in:
javayhu 2025-03-29 22:36:22 +08:00
parent 34ffcc989e
commit 88202b7cc9
7 changed files with 44 additions and 12 deletions

View File

@ -208,7 +208,7 @@ A link like www.example.com or https://example.com would automatically be conver
This works for email links too: contact@example.com.
<Cards>
{/* <Cards>
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" />
</Cards>
</Cards> */}

View File

@ -208,7 +208,7 @@ A link like www.example.com or https://example.com would automatically be conver
This works for email links too: contact@example.com.
<Cards>
{/* <Cards>
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" />
</Cards>
</Cards> */}

View File

@ -169,7 +169,9 @@
"searchNoResult": "No results",
"previousPage": "Previous",
"nextPage": "Next",
"chooseLanguage": "Select language"
"chooseLanguage": "Select language",
"homepage": "Homepage",
"title": "MkSaaS Docs"
},
"Marketing": {
"navbar": {

View File

@ -164,7 +164,9 @@
"searchNoResult": "没有结果",
"previousPage": "上一页",
"nextPage": "下一页",
"chooseLanguage": "选择语言"
"chooseLanguage": "选择语言",
"homepage": "首页",
"title": "MkSaaS 文档"
},
"Marketing": {
"navbar": {

View File

@ -11,6 +11,7 @@ import type { Metadata } from 'next';
import { Locale } from 'next-intl';
import { notFound } from 'next/navigation';
import { LOCALES } from '@/i18n/routing';
import { Mdx } from '@/components/shared/mdx-component';
export function generateStaticParams() {
const locales = LOCALES;

View File

@ -7,7 +7,6 @@ import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
/**
* Docs layout configurations
*
* https://fumadocs.vercel.app/docs/ui/layouts/docs
*/
export const baseOptions: BaseLayoutProps = {

View File

@ -1,13 +1,16 @@
import { baseOptions } from '@/app/[locale]/docs/layout.config';
import { LOCALE_LIST } from '@/i18n/routing';
import { source } from '@/lib/docs/source';
import { Translations } from 'fumadocs-ui/i18n';
import { I18nProvider, Translations } from 'fumadocs-ui/i18n';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
import { Locale } from 'next-intl';
import { getTranslations } from 'next-intl/server';
import type { ReactNode } from 'react';
import { DocsProviders } from './providers-docs';
import { I18nProvider } from 'fumadocs-ui/i18n';
import { LOCALE_LIST } from '@/i18n/routing';
import { getTranslations } from 'next-intl/server';
import { ModeSwitcher } from '@/components/layout/mode-switcher';
import { Logo } from '@/components/logo';
import { websiteConfig } from '@/config';
import { docsI18nConfig } from '@/lib/docs/i18n';
import '@/styles/docs.css';
@ -38,6 +41,31 @@ export default async function DocsRootLayout({ children, params }: DocsLayoutPro
chooseLanguage: t('chooseLanguage'),
};
const baseOptions: BaseLayoutProps = {
i18n: docsI18nConfig,
githubUrl: websiteConfig.social.github ?? undefined,
nav: {
title: (
<>
<Logo className="size-6" />
{t('title')}
</>
),
},
links: [
{
text: t('homepage'),
url: '/',
active: 'nested-url',
}
],
themeSwitch: {
enabled: true,
mode: 'light-dark-system',
component: <ModeSwitcher />
},
};
return (
<DocsProviders>
<I18nProvider