{Dynamics Portal :: Localization}

Recently, we got a requirement to localize the dynamics portal for different languages. 

Usually, It works well for the OOB forms and fields.

Some places, we have made custom validation/error messages, UI changes, added more custom functionality for end user requirements. These parts,  we need to do some logic to make the localization. If we are using the web templates / liquid templates, we can utilize the content snippets.

Here is link  which has steps to enable multiple languages in portal.

Lets come to my requirement. so we decided to have one localization file which is in JSON format. we will check the user’s language on load of the form and set the labels accordingly.

Sample format in localization file

[ { "SnippetName": "fn_contactlibrary", "LstValues": [ { "LanugageCode": 1033, "SnippetValue": "contact Library" }, { "LanugageCode": 1031, "SnippetValue": "Kontakt Bibliothek" } ] } ]

here is the java-script snippet which helps to load the web files ( where i have stored the localization json file)

// below function load the specified webfile into ldData variable var lpData = $.ajax({ url: "~/localization", dataType: 'json', data: null, async: false }); lpData = lpData["responseJSON"]; // this function helps to get the required snippet by its name and lang // code function GetLocalizedContent(lpData, sName, lCode) { var sValue = ""; $.each(lpData, function(i, item) { if (item.SnippetName == sName) { item.LstValues.filter(function(i, n) { if (item.LstValues[n].LanugageCode == lCode) { sValue = item.LstValues[n].SnippetValue; } }); } }); return sValue; }

Hope it helps you in some point to extend the localization in Dynamics portal. 

Please do let me know your comments and thoughts on this post.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

If you need any help on Dynamics project and training, reach out to me. Do connect with me on LinkedIn and follow this blog to know more about Dynamics and its related stuff. Once again, Happy to connect with you all through blogging. Do you share your valuable feedback?
%d bloggers like this: