I18n

INFO

Internalization support is not enforced on theme builders, so you'll need to refer to the theme's documentation to see if it's supported. The default theme provided by Vitebook supports i18n.

In order to add internationalization support you'll need to ensure you have the right directory structure. Each locale should contain it's own top-level directory as shown below.

src
├─ foo.md
└─ zh
   ├─ foo.md
└─ tr
   ├─ foo.md

Next, specify the locales in your site configuration...

import { defineConfig } from '@vitebook/client/node';

export default defineConfig({
  // ...
  site: {
    // ...
    locales: {
      '/': {
        lang: 'en-US',
        title: 'Vitebook',
        description: '...',
        langLabel: 'English',
      },
      '/zh': {
        lang: 'zh-CN',
        title: 'Vitebook',
        description: '...',
        langLabel: 'Chinese',
      },
      '/tr': {
        lang: 'tr',
        title: 'Vitebook',
        description: '...',
        langLabel: 'Turkish',
      },
    },
  },
});






 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


Default Theme

If you're using the default theme you can specify options per locale as follows...

INFO

You can omit values inside any locale-specific config, and it'll fallback to the root value (in this case English).

import { defineConfig } from '@vitebook/client/node';
import type { DefaultThemeConfig } from '@vitebook/theme-default/node';

export default defineConfig<DefaultThemeConfig>({
  site: {
    // ...
    locales: {
      '/': {
        lang: 'en-US',
        title: 'Vitebook',
        description: '...',
        langLabel: 'English',
      },
      '/tr': {
        lang: 'tr',
        title: 'Vitebook',
        description: '...',
        langLabel: 'Turkish',
      },
    },
    theme: {
      '/': {
        // English configuration options.
      },
      '/tr': {
        // Turkish configuration options.
      },
    },
  },
});