locale URL parameter

5048
7
Jump to solution
11-12-2015 05:17 AM
BenedekSimó
New Contributor III

I have tested to add a URL parameter(?locale=FR-fr) to my applications endpoint, but the application kept using the same (default) english labels. In this Guide (Add i18n support—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers ) it says that after using e.g. http://localhost/test/?locale=FR-fr, and a certain widget has

  • "fr": 1, in strings.js
  • and fr folder in the same directory, and within that another strings.js file with the translated strings

it will show up in that language.

I have tested with the eSearch widget, but had no success so far.

Is there any other place where I should set something?

Thanks,

Ben

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
BenedekSimó
New Contributor III

Dear Tim and Robert!

Based on Tim's link I have figured that all I need to do is to set dojoConfig.locale parameter to whatever language I want, and then it is all good!

So for having the option to set the locale from URL parameter, it seems that I have to implement a function in init.js that gets the language code from the URL query string, and sets the dojoConfig.locale value based on this!

Not sure though why is this line in the documentation....

"Reload your application. This time, add a URL parameter, locale=zh-cn, or you change the browser's locale configuration to view the change." (Add i18n support—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers )

But thank you for your help anyways!

View solution in original post

0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Benedek,

   I have never been able to get WAB to display in a different language. There is a gentleman in esri France that helped me add the "fr" locale to the widget and he has the widget working in french. It must be more of an OS thing.

0 Kudos
BenedekSimó
New Contributor III

Thanks for the response, Robert!

I just would like that my app would be bilingual after deployment, not the WAB itself...

For every widget ESRI provides, there's an nls directory with quite a few languages. So what is the correct way to check out the deployed webapp e.g. in german? URL langcode doesn't seems to work...

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Benedek,

   This is not an area I am experienced in. But as I mentioned  I have contacts in esri France and esri Spain that have WAB working in their local languages. So all you need to do as a developer is to provide the nls strings.js file for the language you are trying to support in your custom widget development and when your app is deployed to that locale those string will show.

TimWitt2
MVP Regular Contributor
BenedekSimó
New Contributor III

Dear Tim and Robert!

Based on Tim's link I have figured that all I need to do is to set dojoConfig.locale parameter to whatever language I want, and then it is all good!

So for having the option to set the locale from URL parameter, it seems that I have to implement a function in init.js that gets the language code from the URL query string, and sets the dojoConfig.locale value based on this!

Not sure though why is this line in the documentation....

"Reload your application. This time, add a URL parameter, locale=zh-cn, or you change the browser's locale configuration to view the change." (Add i18n support—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers )

But thank you for your help anyways!

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Benedek,

   It looks like they have fixed this for the new 1.3 release coming for AGOL this month and WAB Dev in December.

BenedekSimó
New Contributor III

Thank you Robert, I appreciate your help!

0 Kudos