Kepler.gl supports localization trough react-intl. Locale is determined by uiState.locale
value.
By default the first language is English en
. The default language can be changed by giving locale value to uiState:
import {combineReducers} from 'redux';
import keplerGlReducer from 'kepler.gl/reducers';
import {LOCALE_CODES} from 'kepler.gl/localization';
const customizedKeplerGlReducer = keplerGlReducer.initialState({
uiState: {
// use Finnish locale
locale: LOCALE_CODES.fi
}
});
const reducers = combineReducers({
keplerGl: customizedKeplerGlReducer,
app: appReducer
});
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 steps:
-
Find out the language code for Swedish:
sv
-
Add new translation file
src/localization/sv.js
by copyingsrc/localization/en.js
and translating the strings -
Update LOCALES in
src/localization/locales.js
to include new language translation:export const LOCALES = { en : 'English', fi : 'Suomi', pt: 'Português', sv: 'Svenska' }