Change Directions widget language arcgis js 3.38

604
4
11-17-2021 06:29 AM
benchikh
New Contributor III

Hi,

I am working with Directions widget within Arcgis api 3.38, and actually Im trying to change the directions language from English to Frensh language.

so I have tried to work with "setDirectionsLanguage(locale)", 

 https://developers.arcgis.com/javascript/3/jsapi/directions-amd.html#setdirectionslanguage

But Im not able to do it correctly... any help please it would be much appreciated.

many thanks

0 Kudos
4 Replies
ReneRubalcava
Frequent Contributor

This worked for me, but with a caveat.

directions.setDirectionsLanguage("fr");

According to the doc, this doesn't change the localization of the widget itself, just the language of the directions results coming from the REST API.

Specify the language used for the directions. The supported languages can be requested from either the Route Service REST API, or from the widget itself

0 Kudos
benchikh
New Contributor III

Hi many thanks for your response,

I have already used it but did not worked for me... directionsW.setDirectionsLanguage("fr");

 

0 Kudos
ReneRubalcava
Frequent Contributor

Try in this sample.

https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=widget_directions_basic

 

Update the code like this.

directions.startup();
// after startup()
directions.setDirectionsLanguage("fr");

This worked for me. I think that method has to be called after the startup() method.

ReneRubalcava_0-1637188584908.png

 

 

benchikh
New Contributor III

Hi, thanks for your help

I have did the same thing but still not working, But I think that the language should be installed first in the NAServer.

many thanks

 

0 Kudos