Geeks With Blogs
SharePoint Wiki! Sharing is gaining...
How do you localize apps?
Using multiple languages in JavaScript code in SharePoint 2013 apps. 
Step 1: Add languages in AppManifest.xml
Update the .resx files, that are used to localize .xml definitions, while JavaScript files are used to localize text displayed on pages with HTML and JavaScript.

Step 2: Add this code to HEAD part of your (app) page:
<script type="text/javascript" src="../scripts/Resources.<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,language_value%>' EncodeMethod='HtmlEncode' />.js"></script>

Let's say we want to localize word "All" in French:
Step 3: Add Resources.js file to "Scripts" module in your project
Step 4: Add this code to Resources.js:

function Resources_All() { return "All"; }

Step 6: Add Resources.fr-FR.js file to "Scripts" module
Step 7: Add this code to Resources.fr-FR.js:

function Resources_All() { return "Tout"; }

That's all. Use it in variable:

var all=Resources_All();

"var all=Resources_All();" will return "Tout" on French SharePoint sites, and it will return "All" for sites in other languages.

Happy Localizing!

Posted on Tuesday, April 2, 2013 4:07 PM SharePoint , SharePoint 2013 , Apps , Localize , JavaScript | Back to top


Comments on this post: How to create a Multilingual Apps For SharePoint 2013 using JavaScript

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © KunaalKapoor | Powered by: GeeksWithBlogs.net