@shenyong/mapbox-gl-language
v0.0.5
Published
Change map language
Downloads
9
Readme
📖 @shenyong/mapbox-gl-language
Localize map or change dynamically language.
By default, supported languages option is the supported list by mapbox styles.
npm i @shenyong/mapbox-gl-language
// set language from browser, use 'mul' as fallback
map.addControl(new LanguageControl());
// set custom language while initialization
const languageControl = new LanguageControl({
language: 'ru',
});
map.addControl(languageControl);
// or change language dynamically
languageControl.setLanguage(event.target.value);
Options
export type LanguageControlOptions = {
supportedLanguages?: string[] | undefined;
language?: string | undefined;
getLanguageKey?: ((language: string) => string) | undefined;
excludedLayerIds?: string[] | undefined;
};
Methods
setLanguage(lang?: string | undefined): void;
- set dynamically map language