vitepress-i18n
v1.3.0
Published
VitePress i18n is a plugin for VitePress that makes it easy to translate text in the default theme and search tool.
Downloads
653
Maintainers
Readme
🔌 VitePress i18n
VitePress i18n is a plugin for VitePress that makes it easy to translate text in the default theme and search tool. It translates the default layout with a simple setup and can be used in multiple projects without duplicate code.
- ⚡️ Optimized for the latest version of VitePress
- ⚡️ Lightweight bundle file size, zero dependencies
- ⚡️ TypeScript support
Documentation (Getting Started & All option lists)
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
The currently supported translation languages and translateLocale
matching values are as follows:
(*
= 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 { 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 { withI18n } from 'vitepress-i18n';
const vitePressOptions = {
title: 'VitePress',
themeConfig: {
// ...
}
};
const vitePressI18nOptions = {
locales: [
{ path: 'en', locale: 'en' },
{ path: 'ko', locale: 'ko' }
],
rootLocale: 'en',
label: {
en: 'English',
ko: '한국어'
},
lang: {
en: 'en-US',
ko: 'ko-KR'
},
description: {
en: 'Hello',
ko: '안녕하세요'
}
};
export default defineConfig(withI18n(vitePressOptions, vitePressI18nOptions));
Contribute
You can report issues on GitHub Issue Tracker.
You can also request a pull to fix bugs and add frequently used features.
License
Copyright © 2024 CDGet <[email protected]> Released under the MIT license.