Skip to main content

i18n

locale controls visible chart copy (crosshair open/high/low/close/volume, interval units, etc.). Built-in: zh-CN, en-US. Register custom languages with registerLocale, then switch.

This is not an app-level i18n framework; host UI copy (toolbars, etc.) stays yours.

API

KeisenChart

Prop / eventTypeDescription
localestringlocale id, default zh-CN
onLocaleChange / Vue locale-change(localeId: string) => voidControlled callback

useKlineLocale()

Must be called inside the KeisenChart subtree (e.g. header).

ReturnTypeDescription
localestring (Ref<string> in Vue)Current locale id
setLocale(localeId: string) => voidSwitch locale
messagesLocaleMessagesResolved message table (read-only)

registerLocale

registerLocale(id: string, messages: Partial<LocaleMessages>): void

Missing keys fall back to zh-CN. Fields: time / open / high / low / close / volume / second / minute / hour / day / week / month / year.

Example

Custom locale + useKlineLocale switching:

Loading interactive example…