map0

Configuration

Languages

The viewer includes German and English. Override interface text per language in the config, or add your own translations.

Look closely: the panel is titled Kartenthemen, not the built-in Kartenebenen, and the legend reads Zeichenerklärung. Both come from i18n.overrides. Tooltips of the MapLibre controls follow the same locale.

How the locale is chosen

For each key, map0 checks the locale’s override and built-in dictionary, then the fallback language’s override and dictionary. If no translation is found, it displays the key itself.

Configuration

i18n.map0.json
{
  "$schema": "https://map0.net/schema/v1.json",
  "version": 1,
  "meta": { "title": "UI languages and string overrides" },
  "map": { "center": [16.3725, 48.2083], "zoom": 13 },
  "i18n": {
    "locale": "de",
    "fallback": "en",
    "overrides": {
      "de": {
        "layers.title": "Kartenthemen",
        "basemaps.title": "Grundkarte",
        "legend.title": "Zeichenerklärung"
      }
    }
  },
  "basemaps": [
    {
      "id": "grau",
      "title": "Grau",
      "type": "raster",
      "url": "https://mapsneu.wien.gv.at/basemap/bmapgrau/normal/google3857/{z}/{y}/{x}.png",
      "attribution": "© basemap.at",
      "default": true
    },
    {
      "id": "bmapv",
      "title": "basemap.at",
      "type": "style",
      "url": "https://mapsneu.wien.gv.at/basemapv/bmapv/3857/resources/styles/root.json"
    }
  ],
  "layers": [
    {
      "id": "widmung",
      "type": "wms",
      "title": "Flächenwidmung",
      "url": "https://data.wien.gv.at/daten/geo",
      "layers": "GENFLWIDMUNGOGD",
      "opacity": 0.5,
      "legend": "auto",
      "info": { "format": "application/json" },
      "attribution": "Stadt Wien, data.wien.gv.at"
    }
  ],
  "controls": { "layerSwitcher": { "open": true }, "legend": { "open": true } }
}

A new language from config alone

excerpt
"i18n": {
  "locale": "it",
  "fallback": "en",
  "overrides": {
    "it": {
      "layers.title": "Livelli",
      "basemaps.title": "Mappa di base",
      "legend.title": "Legenda"
    }
  }
}

Anything not translated falls back to English rather than disappearing.