Localization of WEB APP widgets

1365
4
Jump to solution
06-15-2019 03:27 AM
MartinSirkovsky1
New Contributor III

I have setup a WEB APP on ArcGIS online and then I have downloaded it to be hosted locally on our server. I wish to change some text in danish localization to a faroese texts, which serves our purpose.

I was able to change many of the texts by accessing a NLS folder for a widget I want to customize (e.g. query widget "...widgets\Query\nls\Widget_da.js" and change the texts. But some widgets do not have text strings in NLS folder, specifically "measaurement" widget. I have managed to change the lables by adding a following js code to the measurement widget js code, right before the original code starts (see attached image):

require(["dojo/i18n!esri/nls/jsapi"],
function(bundle) {
// bundle.widgets.measurement.NLS_area_sq_kilometers = "km<sup>2</sup>";
// bundle.widgets.measurement.NLS_resultLabel = "Mlæ";
}
);

However, I realize that this is probably not best solution. My questions are:

  • Where to add a custom code like this if I wish to extend a widget. Remember, I have downloaded the code from AGOL, I am not working with WAB for developers.

  • I would imagine that this code will change the texts  for all languages not only for  danish. Is there a way I can change the text only one language?

Thank you

Martin

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Martin,

   That is coming from the JS API:

require(["dojo/i18n!esri/nls/jsapi"], function(esriJSnls) {
  console.log(esriJSnls.widgets.FeatureTable.empty);
});

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Martin,


   That is the right way to localize strings that are coming from the JS API like the measurement widget. The only thing you can do is add an if statement to check is the browsers locale is danish and apply your string change or not.

MartinSirkovsky1
New Contributor III

Hey Robert.

Do you, or maybe someone else know how to modify the string "- empty -" which is used as placeholder in input field in query widget?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Martin,

   That is coming from the JS API:

require(["dojo/i18n!esri/nls/jsapi"], function(esriJSnls) {
  console.log(esriJSnls.widgets.FeatureTable.empty);
});
RobertScheitlin__GISP
MVP Emeritus

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

0 Kudos