Map Language
Switch the map label language at runtime without reloading the style. Useful for multi-language apps or when you want to match the device locale.
Set map language
await controller.setMapLanguage('fr'); // French
await controller.setMapLanguage('de'); // German
await controller.setMapLanguage('es'); // Spanish
await controller.setMapLanguage('ja'); // Japanese
await controller.setMapLanguage('en'); // English (default for most styles)
The language code is an ISO 639-1 two-letter code.
Match device locale
import 'dart:ui';
final locale = PlatformDispatcher.instance.locale;
final lang = locale.languageCode; // e.g. 'it', 'en', 'fr'
await controller.setMapLanguage(lang);
Language availability
Not all tile sources include multilingual labels. Support depends on your tile provider:
| Provider | Multilingual support |
|---|---|
| OpenFreeMap Liberty | ✔ Yes (name:en, name:fr, name:de, etc.) |
| OpenMapTiles | ✔ Yes |
| Protomaps | ✔ Yes (name:en and native) |
| Custom raster tiles | ✘ No (labels are baked into the image) |
Note
setMapLanguage() works by updating text-field expressions in all symbol layers that contain name fields. If your custom style uses non-standard property names, this method may not affect all labels.