LogoClawti
Discover이미지 생성캐릭터 만들기
캐릭터 검색
Internationalization
2025/03/15

Internationalization

Support multiple languages in your documentation

Before you get started

Fumadocs is not a full-powered i18n library, it manages only its own components and utilities.

You can use other libraries like next-intl for the rest of your app. Read the Next.js Docs to learn more about implementing I18n in Next.js.

Manual Setup

Define the i18n configurations in a file, we will import it with @/ilb/i18n in this guide.

Pass it to the source loader.

lib/source.ts
import { i18n } from '@/lib/i18n';
import { loader } from 'fumadocs-core/source';

export const source = loader({
  i18n, 
  // other options
});

And update Fumadocs UI layout options.

app/layout.config.tsx
import { i18n } from '@/lib/i18n';
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';

export function baseOptions(locale: string): BaseLayoutProps {
  return {
    i18n,
    // different props based on `locale`
  };
}

Middleware

Create a middleware that redirects users to appropriate locale.

{
  "file": "../../examples/i18n/middleware.ts",
  "codeblock": {
    "lang": "ts",
    "meta": "title=\"middleware.ts\""
  }
}

See Middleware for customisable options.

Note that this is optional, you can also use your own middleware or the one provided by i18n libraries.

Routing

Create a /app/[lang] folder, and move all files (e.g. page.tsx, layout.tsx) from /app to the folder.

Wrap the root provider inside I18nProvider, and provide available languages & translations to it. Note that only English translations are provided by default.

app/[lang]/layout.tsx
import { RootProvider } from 'fumadocs-ui/provider';
import { I18nProvider, type Translations } from 'fumadocs-ui/i18n';

const cn: Partial<Translations> = {
  search: 'Translated Content',
  // other translations
};

// available languages that will be displayed on UI
// make sure `locale` is consistent with your i18n config
const locales = [
  {
    name: 'English',
    locale: 'en',
  },
  {
    name: 'Chinese',
    locale: 'cn',
  },
];

export default async function RootLayout({
  params,
  children,
}: {
  params: Promise<{ lang: string }>;
  children: React.ReactNode;
}) {
  const lang = (await params).lang;

  return (
    <html lang={lang}>
      <body>
        <I18nProvider
          locale={lang}
          locales={locales}
          translations={{ cn }[lang]}
        >
          <RootProvider>{children}</RootProvider>
        </I18nProvider>
      </body>
    </html>
  );
}

Pass Locale

Pass the locale to Fumadocs in your pages and layouts.

Search

Configure i18n on your search solution.

  • Built-in Search (Orama): For Supported Languages, no further changes are needed.

    Otherwise, additional config is required (e.g. Chinese & Japanese). See Special Languages.

  • Cloud Solutions (e.g. Algolia): They usually have official support for multilingual.

Writing Documents

Navigation

Fumadocs only handles navigation for its own layouts (e.g. sidebar). For other places, you can use the useParams hook to get the locale from url, and attend it to href.

import Link from 'next/link';
import { useParams } from 'next/navigation';

const { lang } = useParams();

return <Link href={`/${lang}/another-page`}>This is a link</Link>;

In addition, the fumadocs-core/dynamic-link component supports dynamic hrefs, you can use it to attend the locale prefix. It is useful for Markdown/MDX content.

content.mdx
import { DynamicLink } from 'fumadocs-core/dynamic-link';

<DynamicLink href="/[lang]/another-page">This is a link</DynamicLink>
All Posts

Author

avatar for MkSaaS
MkSaaS

Categories

  • Company
  • Product
Manual SetupMiddlewareRoutingPass LocaleSearchWriting DocumentsNavigation

More Posts

Comparisons
CompanyNews

Comparisons

How is Fumadocs different from other existing frameworks?

avatar for Fox
Fox
2025/03/22
Quick Start
CompanyNews

Quick Start

Getting Started with Fumadocs

avatar for MkSaaS
MkSaaS
2025/03/28
What is Fumadocs
CompanyProduct

What is Fumadocs

Introducing Fumadocs, a docs framework that you can break.

avatar for Fox
Fox
2025/04/01

Newsletter

Join the community

Subscribe to our newsletter for the latest news and updates

LogoClawti
시작하기

Clawti는 발견, 대화, 발행을 하나로 연결한 크리에이터 중심 AI 캐릭터 플랫폼입니다.

Discover 열기채팅 시작

공식 소셜 채널이나 계정 지원이 필요하면 아래 커뮤니티 페이지를 이용해 주세요.

X (Twitter)RYouTube
기능
  • 이미지 생성
  • 캐릭터 만들기
  • 태그
  • 새 토픽
  • 인기 시리즈
제작 가이드
  • 만드는 방법
  • 캐릭터 이전
  • 인기 캐릭터 제작
소개
  • 최고의 AI 챗봇
  • 궁극의 AI 채팅
  • 최고의 AI 코딩 도구
  • 사용 방법
법적 안내
  • 개인정보 처리방침
  • 이용약관
  • 계정 삭제

© 2026 Clawti. 모든 권리 보유.

커뮤니티 및 지원