How do I set the language in Vaadin Maps

95 views Asked by At

The examples all seem to use the countries primary language when rendering the maps which is cool but is challenging when I'm looking at countries written in languages I'm not familiar with. With that in mind how I can setup the map view to show all the cities, countries, etc. in a specified language?

1

There are 1 answers

1
Sascha Ißbrücker On

I'm assuming that you are using the default OpenStreetMap source, but the same applies for all image-based maps. For image-based maps the labels are part of the images that are loaded from the map service to display the map. For example, see the following OpenStreetMap map tile, which shows a part of Japan, you can see that the label is in the image itself: https://tile.openstreetmap.org/3/7/2.png

enter image description here

As such there is no way to change the locale on the fly in the component itself. Instead, if you want to display labels in a different language, you need to use different map data that provides images that contain the labels in a different language. OpenStreetMaps has a Map Internationalization page that provides some information and resources. There are also commercial map services that provide maps in different locales. When you have found a service that provides map data in the locale that you want to use, then you can configure a source in the map component to load data from that service. See the map sources documentation on how to do that.