Skip to content

Localization

cvasseng edited this page Jan 25, 2017 · 4 revisions

The Highcharts Editor has a simple localization system that can be used to translate the UI to different languages.

To use it, first add a new language file to localization/. See localization/en.json for the format. The filename should correspond to the language code (e.g. en, fr etc.).

Once a localization file has been added, run node tools/gen.localization.js. This will bake language packs for each of the translations available in the localization folder, and put them in dist/. These files can then be included in the page the editor is included in. To activate a given language, call highed.setLang(languageCode) prior to initializing the editor.

Note that the English localization is included in the baked sources by default. The English dictionary is also used as a reference when baking, so if there are options in en.json which are not present in another translation file, the generator script will generate warnings so that it's easy to verify the completeness of a translation.

The default language can be set as a global option using highed.option('defaultLanguage', '<code>');.