4

I have created a sample Hello world webpart using the Examples provided at Office site

Webpart has a Property called "Description" in Property Pane which displayed in English Language.

I would like to display in "Description" in German language for German User. Is it possible to do so, I try to refer this Page to get understanding of how Resource Localisation works, but not got much Help.

I wanted to know is it possible if i force in my code to load specfic Language Resource file. Currently in Config.json of the solution I have

"localizedResources": { "expStrings": "webparts/exp/loc/{locals}.js" }

Under the Resource files i have en-us.js and de-de.js , how i can force code to load de-de.js instead of en-us.js.

I have requirement to Display the Webpart Description based on Users Language.

Thanks in advance for help

1

When starting the workbench by default it uses the en-US locale. To override this you can run:

$ gulp serve --locale=de-de

which will cause the workbench to use the de-DE locale instead.

Another way to test it, is to use the hosted version of workbench in the context of a German site. In O365 create a new Team Site using the de-DE locale (let's say its URL is https://contoso.sharepoint.com/sites/mysite). Then you would open the workbench using https://contoso.sharepoint.com/sites/mysite/_layouts/15/workbench.aspx which would be using the de-DE locale.

  • Thanks for your response. i have scenario like same site collection will be used across globe but we have to translate the webpart Title based on the User Preferred Locale, is there any way we can force to load the respective Locale via code? – vinit kumar Jan 11 '17 at 5:42
  • You mean the title displayed in the toolbox when adding the web part to the page? SharePoint Framework automatically loads the resource file corresponding to the current locale so there is no need for you to force it. – Waldek Mastykarz - MVP Jan 13 '17 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.