- Xrm.Page.context.getUserLcid() - returns the LCID value that represents the Microsoft Dynamics CRM Language Pack that is the user selected as their preferred language
- Xrm.Page.context.getOrgLcid() - returns the LCID value that represents the base language for the organization
The attached library provides an easy way to get the culture name and the language region from the decimal lcid value, it contains two methods:
- LCIDUtils.getCultureName(lcid)
returns a string with the culture name of the selected lcid valuevar userLcid = Xrm.Page.context.getUserLcid(); var userCultureName = LCIDUtils.getCultureName(userLcid); alert("User Culture name is: " + userCultureName);
- LCIDUtils.getLanguageRegion(lcid)
returns a string with the language region of the selected lcid valuevar orgLcid = Xrm.Page.context.getOrgLcid(); var orgLanguageRegion = LCIDUtils.getLanguageRegion(orgLcid); alert("Organization Language Region is: " + orgLanguageRegion);
http://gallery.technet.microsoft.com/scriptcenter/LCID-JavaScript-Helper-7cfb0829
Note: The culture name and language region mappings come from this MSDN page: National Language Support (NLS) API Reference (Windows 7)
0 comments:
Post a Comment