can not translate resources. dojo/i18n!esri/nls/jsapi is missed in JS 4.6

2441
13
04-11-2018 01:07 AM
SergeyVladimirov
New Contributor II

in java script 3.* there was library "dojo/i18n!esri/nls/jsapi"

require(["esri/map", "dojo/i18n!esri/nls/jsapi", "dojo/domReady!"],
  function(Map, bundle) {
    bundle.widgets.legend.NLS_noLegend = "My No Legend";
  }
);

But it looks that "dojo/i18n!esri/nls/jsapi" is missed in js 4.6. So i can not translate any text.

Is there any other way to localize resources ?

0 Kudos
13 Replies
KenBuja
MVP Esteemed Contributor

It's slightly different syntax in 4.x  Localization | ArcGIS API for JavaScript 4.6 

require(["esri/Map", "dojo/i18n!esri/nls/common", "dojo/domReady!"],
  function(Map, bundle) {
      bundle.form.yes = "Yeah!";
      bundle.form.no = "No way!";
  }
);
SergeyVladimirov
New Contributor II

common library does not help. there is no resources of widgets etc

0 Kudos
KenBuja
MVP Esteemed Contributor

Yes, it looks like it's missing many items. This is probably a good thing to bring up with Support or submit an Idea.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Actually the structure has just changed and the nls file for each widget in not in a common type file it is in it's own specific nls file. 

I.e. here is the attribution widget:

https://js.arcgis.com/4.7/esri/widgets/Attribution/nls/Attribution.js 

KenBuja
MVP Esteemed Contributor

That's very useful information Robert. This really needs to go into the documentation!

0 Kudos
SergeyVladimirov
New Contributor II

Thanks a lot for answer, Robert. It really helps

0 Kudos
SergeyVladimirov
New Contributor II

unfortunately it does not work. i can not translate any text. not sure how to do this in right way. It loads libraries , but when i change any text it does not affect on labels of widget

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sergey,

  Sorry you are right it does not work. I am not sure why though. Let me tag some esri folks on this:

odoeMDriscoll-esristaff

0 Kudos
SergeyVladimirov
New Contributor II

It would be great to get any help on this. thank you

0 Kudos