How to translate Webmap with ArcGIS JS API?

693
0
12-04-2020 06:12 AM
ChristianBischof
Esri Contributor

I have found the setLocale() Method:

Localization | ArcGIS API for JavaScript 4.17

But it only seems to apply changes to the widgets which are used within the webmap, but not the actual webmap. For example the webmaps countries are labeled in English but I need it to be in Russian as it was applied to a widget (here in this example I have used the Measurement widget).

Does anybody have an idea how to change the labeling language of the webmap itself and not just its components? Thanks in advance!

Code

 

require(["esri/views/MapView", "esri/WebMap", "esri/intl", "esri/widgets/Measurement"], function (
        MapView,
        WebMap,
        intl,
        Measurement
      ) {

        var webmap = new WebMap({
            basemap: 'topo'
        });

        var view = new MapView({
          map: webmap,
          container: "viewDiv"
        });
        
        
        const measurement = new Measurement({
          view: view,
          activeTool: "distance"
        });
        view.ui.add(measurement, "top-right");

        view.when(function () {
            intl.onLocaleChange(function(locale) {
                console.log("locale changed to: ", locale);
            });

            intl.setLocale("ru");
        });
      });

 

 

0 Kudos
0 Replies