Internationalization
Previous
Tooltip
Next
数据格式化
Loading...
S2
currently has built-中/英
two sets of copywriting, the default is Chinese , view all files
Switch the international text by setLang
, note: it needs to be called before the table is instantiated
NB. Right now you only can use en_US
, zh_CN
, and ru
built-in locales.
import { setLang, PivotSheet } from '@antv/s2'setLang('en_US')// setLang('zh_CN')// setLang('ru_RU');const s2 = new PivotSheet()s2.render()
Extend the internationalized text through extendLocale
, note: it needs to be called before the table is instantiated
import { i18n, extendLocale } from '@antv/s2'const locale = {zh_CN: {test: '测试',},en_US: {test: 'test',},ru_RU: {test: 'тест',},};extendLocale(locale)// 使用i18n('test')
import { i18n, getLocale, getLang, setLang } from '@antv/s2'// 获取当前语言getLang() // 'zh_CN'// 切换语言setLang('en_US')// 获取当前国际化文件getLocale()// 国际化函数i18n('隐藏') // 'Hide'