Skip to main content

Customize Language

Customize Language

Change the language of user-facing copy in Leaflet-Geoman

map.pm.setLang("de");

Currently available languages are cz, da, de, el, en, es, fa, fi, fr, hu, id, it, ja, ko, ky, nl, no, pl, pt_br, ro, ru, sv, tr, ua, zh and zh_tw.
To add translations to the plugin, you can add a translation file via Pull Request.

You can also provide your own custom translations.

const customTranslation = {
tooltips: {
placeMarker: "Custom Marker Translation",
},
};

map.pm.setLang("customName", customTranslation, "en");

The 3rd parameter is the fallback language in case you only want to override a few Strings.
See the english translation file for all available strings.

The following events are available on a map instance:

EventParamsDescriptionOutput
pm:langchangeeFired when language is changed.activeLang, oldLang, fallback, translations