Change a map’s language

You can utilize the setLanguage function to dynamically switch between languages. This function allows you to modify the language setting for the labels that appear on maps. By following these guidelines, users can customize the language of map labels based on their personal preferences.

NPM module setup


npm install --save @maptiler/sdk
import { Map, MapStyle, config } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
    container: 'map',
    style: MapStyle.BASE, 
    center: [16.05, 48],
    zoom: 2.9
});

document
    .getElementById('buttons')
    .addEventListener('click', function (event) {
        const language = event.target.id;
        map.setLanguage(maptilersdk.Language[language]);
    });
How to change the map labels language based on visitor's location

Map language by IP

Tutorials

This tutorial shows how to automatically change the map labels language based on visitor's location usign the MapTiler Geolocation API.

How to specify the geocoding control language(s) response text and prioritization

Geocoding language

Examples

Specify languages for geocoding response text and query weighting.

Display and style rich text labels

Display and style rich text labels

Examples

Display multilingual rich text labels using format expressions.

How to change the default map labels language

Set map language

Tutorials

This tutorial shows how to change the default map labels language.

Was this helpful?