Skip to content

About

🔌 VitePress i18n is a plugin for VitePress that makes it easy to translate text in the default theme and search tool.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

18 stars

Watchers

1 watching

Forks

Repository files navigation

🔌 VitePress i18n

awesome-vitepress license Programming Language Usage Commit Count npm downloads npm latest package npm bundle size Followers Stars

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 withI18n call, with no translation files to create or keep in sync
  • Local search and Algolia DocSearch are translated as well
  • label and a per locale themeConfig replace the built-in text, and title, description and head can differ per locale
  • Folders such as eng or kor can be mapped to language codes with { path, locale }
  • Optimized for the latest version of VitePress, with zero dependencies and TypeScript types

Installation

VitePress i18n requires Node.js 22 or later. Install it as a dev dependency:

npm i -D vitepress-i18n

Installing 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

Supported languages

(* = 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

Example

Basic configurations

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));

With complex configurations

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));

Contributing

Anyone can contribute to the project by reporting new issues or submitting a pull request. For more information, please see CONTRIBUTING.md.

License

Please see the LICENSE file for more information about project owners, usage rights, and more.

About

🔌 VitePress i18n is a plugin for VitePress that makes it easy to translate text in the default theme and search tool.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

18 stars

Watchers

1 watching

Forks

Sponsor this project

Used by

Contributors

Languages