Kibana Localisations
Kibana relies on several UI frameworks (ReactJS and AngularJS) and Internationalization engine is framework agnostic and consumable in all parts of Kibana (ReactJS, AngularJS and NodeJS).
Localization files are JSON files.
Using comments can help to understand which section of the application the localization key is used for. Also namespaces
are used in order to simplify message location search. For example, if we are going to translate the title of /management/sections/objects/_objects.html
file, we should use message path like this: 'management.objects.objectsTitle'
.
Each Kibana plugin has a separate folder with translation files located at
{path/to/plugin}/translations/{locale}.json
where locale
is ISO 639 language code.
For example:
src/legacy/core_plugins/kibana/translations/fr.json
The engine scans x-pack/legacy/plugins/*/translations
, src/core_plugins/*/translations
, plugins/*/translations
and src/legacy/ui/translations
folders on initialization, so there is no need to register translation files.
The engine uses a config/kibana.yml
file for locale resolution process. If locale is defined via i18n.locale
option in config/kibana.yml
then it will be used as a base locale, otherwise i18n engine will fall back to en
. The en
locale will also be used if translation can't be found for the base non-English locale.
One of our technical requirements is to have default messages in the templates themselves, and those messages will always be in English, so we don't have to keep en.json
file in repository. We can generate that file from defaultMessage
s defined inline.
Note: locale defined in i18n.locale
and the one used for translation files should match exactly, e.g. i18n.locale: zh
and .../translations/zh-CN.json
won't match and default English translations will be used, but i18n.locale: zh-CN
and.../translations/zh-CN.json
or i18n.locale: zh
and .../translations/zh.json
will work as expected.
Note: locale should look like zh-CN
where zh
- lowercase two-letter or three-letter ISO-639 code and CN
- uppercase two-letter ISO-3166 code (optional). ISO-639 and ISO-3166 codes should be separated with -
character.