Skip to content

Latest commit

 

History

History

language

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

<< all controls

📖 @mapbox-controls/language

Localize map or change dynamically language.

By default, supported languages option is the supported list by mapbox styles.

npm i @mapbox-controls/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 ControlOptions = {
    supportedLanguages?: string[];
    language?: string;
    getLanguageKey?: (language: string) => string;
    excludedLayerIds?: string[];
};

Methods

  • setLanguage(lang?: string | undefined): void; - set dynamically map language