Change your map’s label language

When building a map from a Mapbox template style, map labels will appear in English by default. You can change the language of your map’s labels directly in the Mapbox Studio style editor or dynamically using Mapbox GL JS or the Mapbox Android SDK. This article also outlines changing label langauge in Mapbox Studio Classic.

Languages available

All Mapbox template maps use the Mapbox Streets vector tile tileset for map features. In this tileset, there are seven different name fields for each of the label layers:

  • name — the name or names used locally for the place
  • name_en — English (if available)
  • name_es — Spanish (if available)
  • name_fr — French (if available)
  • name_de — German (if available)
  • name_ru — Russian (if available)
  • name_zh — Chinese (if available)

For the Spanish, French, and German labels there are additional fallback conditions. Where the local name is in a non-latin writing system and no Spanish/French/German translation is available, these fields will show an English or international version of the name if possible, otherwise they will show the local name.

The name_zh field contains Mandarin using simplified Chinese characters for our custom label layers: #country_label, #state_label, and #marine_label. All other label layers are sourced from OpenStreetMap and may contain one of several dialects and either simplified or traditional Chinese characters in the name_zh field.

Change label language in Mapbox Studio

Layer by layer

  1. Create a new style or edit an existing one in Mapbox Studio.
  2. Select the layer that contains the labels you’d like to edit.
  3. Under the Text tab, click the value next to Text field. A panel will appear with all language options for the layer.
  4. Click the desired language; the map will update on select.

text field Change text-fieldinput box with new language.

text field Resulted new language in map style.

Multiple layers at once

Instead of changing each label layer individually, you can use the Properties panel to change all the label layer’s languages.

Click Properties at the bottom of the layers list to reveal the Properties panel and click Text field. This will show a list of each Text field in your map style. Any change you make in one of these fields will also apply to all other layers that had the same value.

text field

Change label language dynamically

Mapbox GL JS

If you are comfortable with JavaScript, you can also change the language of your labels dynamically by using the .setLayoutProperty() method in Mapbox GL JS. See the language switcher Mapbox GL JS example for more details.

Mapbox Android SDK

With the Mapbox Android SDK, you can change the language of labels on your map dynamically at runtime:

Layer mapText = map.getLayer("place-city-lg-n");

See the Android SDK documentation for details and the language switch example in the Mapbox Android demo app for more code implementation.

Change label language in Mapbox Studio Classic

Most of the Mapbox preset styles in Mapbox Studio Classic will have a @name variable in the CartoCSS. This is where you can set the language. Below are the options and an example of how to set the value of @name to '[name_en]' or English labels.

// Language options: name (local), name_en, name_fr, name_es, name_de
@name: '[name_en]';

Swap out any of the language options inside the brackets to change your labels to that language.

Next, you must set all the labels with the property text-name with the value @name. For example:

#country_label[zoom>=3] {
  text-name: @name;
Next article:

Customize label text for a single label

Additional questions? Ask our support team or learn more about How Mapbox Works.