Localization
Kepler.gl supports localization through react-intl. Locale is determined by uiState.locale
value. Current supported languages are:
en
English
default
fi
Finnish
pt
Portuguese
ca
Catalan
es
Spanish
ja
Japanese
cn
Chinese
ru
Русский
Changing default language
By default the first language is English en
. The default language can be changed by giving locale value to uiState:
Adding new language
Let's say we want to add the Swedish language to kepler.gl. Easiest way to add translation of new language is to follow these 3 steps:
Find out the language code for Swedish:
sv
Add new translation file
src/localization/translations/sv.js
by copyingsrc/localization/translations/en.js
and translating the stringsUpdate LOCALES in
src/localization/locales.js
to include new language translation:
Modify default translation or add new translation
the localeMessages
prop of KeplerGl
takes additional translations and merge with default translation.
Example 1. Update default translation
To update the english translation of layerManager.addData
, pass localeMessages
like this.
Example 2. Pass additional translation
Sometimes together with dependency injection, you might need to add additional translations to the customized component. For example, adding an additional settings
panel in the side panel, you will need to provide a translation for the panel name assigned to sidebar.panels.settings
Last updated