I18n

Switch Language

We provide Chinese and English by default. The default is Chinese.

import { i18nChangeLanguage } from '@wangeditor/editor'

// Switch language - 'en' or 'zh-CN'
i18nChangeLanguage('en')

// Then create editor

Get Language

Get all language resources.

import { i18nGetResources } from '@wangeditor/editor'

const resources = i18nGetResources('en') // 'en' or 'zh-CN'

Get one word.

import { t } from '@wangeditor/editor'

console.log( t('header.title') )

Extend Other Language

You should add language words config first, then switch.

import { i18nAddResources, i18nChangeLanguage, t } from '@wangeditor/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...
Last Updated:
Contributors: 王福朋