国际化
目前图表内置了en-US和zh-CN两种语言,默认语言是zh-CN。如果需要使用其他语言,需要完成核心图表的语言注册和pro图表的语言注册。
核心图表的语言注册
typescript
import klinecharts from 'klinecharts'
// 可参阅 https://klinecharts.com/guide/i18n.html
klinecharts.registerLocale(`${key}`, {
......
})import klinecharts from 'klinecharts'
// 可参阅 https://klinecharts.com/guide/i18n.html
klinecharts.registerLocale(`${key}`, {
......
})Pro图表语言注册
typescript
import { loadLocales } from '@klinecharts/pro'
// 具体的key参阅 https://github.com/klinecharts/pro/blob/main/src/i18n/zh-CN.json
loadLocales(`${key}`, {
"indicator": "xxx",
"main_indicator": "xxx",
"sub_indicator": "xxx",
......
......
})import { loadLocales } from '@klinecharts/pro'
// 具体的key参阅 https://github.com/klinecharts/pro/blob/main/src/i18n/zh-CN.json
loadLocales(`${key}`, {
"indicator": "xxx",
"main_indicator": "xxx",
"sub_indicator": "xxx",
......
......
})