Select to view content in your preferred language

Localization of measurement tool and Draw

1693
7
04-18-2014 12:19 AM
MatejSkerjanc
Regular Contributor
I'm localizing the two tools and when i debug and go into esri code i can see clearly the bundle in measurement tool accepted these new strings (yes both the measurement and the draw are localized), but when i run new Draw() and go into the code the bundle is not localized. Are they using two different bundles?

example of string setup
  require(["dojo/i18n!esri/nls/jsapi",  "esri/dijit/Measurement"],
            function (bundle, Measurement)
            {
                    bundle.widgets.measurement.NLS_area = i18n.tools.gdiMeasureWidget_config.NLS.area;
                bundle.toolbars.draw.addPoint = i18n.tools.gdiInsertFeatWidget_config.draw.addPointCursorText;
                bundle.toolbars.draw.start = i18n.tools.gdiInsertFeatWidget_config.draw.start;
                bundle.toolbars.draw.resume = i18n.tools.gdiInsertFeatWidget_config.draw.resume;
                bundle.toolbars.draw.start = i18n.tools.gdiInsertFeatWidget_config.draw.start;
                bundle.toolbars.draw.complete = i18n.tools.gdiInsertFeatWidget_config.draw.complete;
.....


Regards,
Matej
0 Kudos
7 Replies
MatejSkerjanc
Regular Contributor
update:

i actually use console.log(bundle) and it is set before the new Draw. I am kind of confused...


P.S. same thing was happening to the measurement, i had dojo.require(esri.measrurement) and an amd require that's probably the issue since when i removed the dojo.require the measurement started working. But i am using amd way for Draw but it still wont work
0 Kudos
MatejSkerjanc
Regular Contributor
another update:



tried to localize the identity manager login screen, the bundle is updated, yet the login screen remains the same as seen on the picture above
0 Kudos
KenBuja
MVP Esteemed Contributor
Does any of the information in this thread help?
0 Kudos
MatejSkerjanc
Regular Contributor
If i'm not mistaken then no this won't help me. Since i am using the bundle to change the text but the text is only changed for the measure widget. And i even tried setting the bundle strings at the  very begining ofthe application code. I'm uncertain what messes it up. Thank you Ken nontheless!
0 Kudos
MatejSkerjanc
Regular Contributor
this might help someone:

if you set locale in djConfig the api disregards any direct string setups, since the widgets obviously read straight from the template.js in NLS folders (in case you set the locale as mentioned).

But the question is whats string to set for toolbar.draw for instance...its not really defined in the documents


Regards,
Matej
0 Kudos
KenBuja
MVP Esteemed Contributor
You can use the debugging tools to see what the values for everything in the bundle is. In Chrome, I used the Create a Map sample, added in the resource bundle, and put in a breakpoint to examine the the bundle. This shows the available values for the draw tool.

[ATTACH=CONFIG]33244[/ATTACH]
0 Kudos
MatejSkerjanc
Regular Contributor
Thank you mr. Ken,
I've debugged it long and thoroughly, as much as a "minified" esri api allows it. I found the reason why my bundle settings arent being accepted (mind the measure tool). I chose the wrong language identifier when forcing the locale with dojoConfig. It seems to have confused the api somehow. I used 'sl-SL' language identifier instead of what navigator.language told me ('sl'). When i used the 'sl' the bundle settings worked flawlessly.

I am still somewhat confused on how the NLS directory kicks in, can't i just input 'toolbars: { addPoint: 'text' }' to change the Draw text? I tried and it didn't work, i had to manually write the
bundle.toolbars.draw.addPoint = i18n.toolbars.draw;

whereas i thought the localized NLS file should take of this automatically. Was I wrong to begin with?
0 Kudos