Fumadocs

Translations

Adding Translations to UI

Overview

This introduction is only for UI translations, you may be interested in the full Internationalization guide instead.

To add translations for only one language:

lib/layout.shared.tsx
import type { Translations } from 'fumadocs-ui/i18n';

// organize your translations:
export const translations: Partial<Translations> = {
  search: '搜尋文檔',
};

Pass the translations via i18n.translations to <RootProvider />.

import { RootProvider } from 'fumadocs-ui/provider/<framework>';
import { translations } from '@/lib/layout.shared';

export function Layout({ children }: { children: React.ReactNode }) {
  return (
    <RootProvider
      i18n={{ translations }}
    >
      {children}
    </RootProvider>
  );
}

How is this guide?

Last updated on

On this page