Skip to content

Interface: Locale ​

A chart's resolved locale (fullLayout._locale): the translation function and the formatters every label, tick and hover text goes through.

Properties ​

PropertyModifierTypeDescription
formatreadonlyReadonly<LocaleFormat>Formats in effect, with decimal / thousands from layout.separators.
namereadonlystringNormalized config.locale.
separatorsreadonlystringDecimal then thousands separator (layout.separators after defaults).

Methods ​

_() ​

ts
_(text): string;

Translate a UI string (Plotly's Lib._); strings without a translation come back as they are.

Parameters ​

ParameterType
textstring

Returns ​

string


numberFormat() ​

ts
numberFormat(specifier): ((n) => string) | null;

A d3-format formatter in this locale, or null for an invalid specifier. Cached.

Parameters ​

ParameterType
specifierstring

Returns ​

((n) => string) | null


timeFormat() ​

ts
timeFormat(specifier): (d) => string;

A UTC d3-time-format formatter in this locale. Cached.

Parameters ​

ParameterType
specifierstring

Returns ​

(d) => string

Released under the MIT License.