I18n
Switch Language
We provide Chinese and English by default. The default is Chinese.
js
import { i18nChangeLanguage } from '@wangeditor-next/editor'
// Switch language - 'en' or 'zh-CN'
i18nChangeLanguage('en')
// Then create editor
Get Language
Get all language resources.
js
import { i18nGetResources } from '@wangeditor-next/editor'
const resources = i18nGetResources('en') // 'en' or 'zh-CN'
Get one word.
js
import { t } from '@wangeditor-next/editor'
console.log( t('header.title') )
Extend Other Language
You should add language words config first, then switch.
js
import { i18nAddResources, i18nChangeLanguage, t } from '@wangeditor-next/editor'
// Extend other language, like Japanese
i18nAddResources('ja', {
// header
header: {
title: 'ヘッダー',
text: 'テキスト',
},
// ... other words config ...
})
// Switch language
i18nChangeLanguage('ja')
// Get one word
console.log( t('header.title') )
// create editor...