VitePress i18n is a plugin for VitePress that makes it easy to translate text in the default theme and search tool. Wrap your config with one function and list the languages you need, and every locale gets its interface text, so the same translations work across projects without duplicate code.
- 13 languages built in, each with its native name in the language menu
- One
withI18ncall, with no translation files to create or keep in sync - Local search and Algolia DocSearch are translated as well
labeland a per localethemeConfigreplace the built-in text, andtitle,descriptionandheadcan differ per locale- Folders such as
engorkorcan be mapped to language codes with{ path, locale } - Optimized for the latest version of VitePress, with zero dependencies and TypeScript types
VitePress i18n requires Node.js 22 or later. Install it as a dev dependency:
npm i -D vitepress-i18nInstalling and using the package and defining all the utility methods can be found on the documentation page below: https://vitepress-i18n.cdget.com/guide/getting-started
(* = Currently using machine translation. Help us improve translation quality with a pull request!)
- English:
en - Korean (한국어):
ko - Chinese Simplified (简体中文):
zhHans *Chinese Traditional (繁體中文):zhHant*Japanese (日本語):ja- Spanish (Español):
es - Portuguese (Português):
pt - Russian (Русский):
ru *Indonesian (Bahasa Indonesia):id*German (Deutsch):de*French (Français):fr*Vietnamese (Tiếng Việt):vi*Italian (Italiano):it
import { defineConfig } from 'vitepress';
import { withI18n } from 'vitepress-i18n';
const vitePressOptions = {
title: 'VitePress',
themeConfig: {
// ...
}
};
const vitePressI18nOptions = {
locales: ['en', 'ko', 'zhHans']
};
export default defineConfig(withI18n(vitePressOptions, vitePressI18nOptions));import { defineConfig } from 'vitepress';
import { withI18n } from 'vitepress-i18n';
const vitePressOptions = {
title: 'VitePress',
themeConfig: {
// ...
}
};
const vitePressI18nOptions = {
locales: [
{ path: 'eng', locale: 'en' },
{ path: 'kor', locale: 'ko' }
],
rootLocale: 'en',
description: {
en: 'Hello',
ko: '안녕하세요'
}
};
export default defineConfig(withI18n(vitePressOptions, vitePressI18nOptions));Anyone can contribute to the project by reporting new issues or submitting a pull request. For more information, please see CONTRIBUTING.md.
Please see the LICENSE file for more information about project owners, usage rights, and more.