Set language for Mapbox Map

Hi, for one of our customers we have created a Locator page using the component.
The customer is from Germany and has requested the map to show all the labels, state names, etc. in German, however I can’t seem to find a way to pass the language setting to the component.
I need advice and help on what the best approach to this would be:

  • Should I use a custom component based off of the existing MapboxMap?
  • According to Mapbox’s documentation I can set the language after the map object has been created, however I can’t find a way to access the map object from outside the component (without modifying it directly)
    If you have an easier/better approach to this, I would love to know. Thanks for your help!

Hey Andrea,

You can set the map’s language through the mapboxOptions prop.

For a full list of mapbox options you can check out their documentation here.

Also for your reference, you can check out our docs on using the MapboxMap component here.

1 Like