I need to get the name of the current UI language in a javascript file. I know the following trick:
SP.Res.lcid
But that gets the the LCID. What I really need is the two-letter iso name (like 'en', 'fr', etc)
I need to get the name of the current UI language in a javascript file. I know the following trick:
But that gets the the LCID. What I really need is the two-letter iso name (like 'en', 'fr', etc) |
|||
|
You can create a JS object and fetch the values using the LCID:
|
|||||
|
I created a JavaScript library to handle your requirement (returns the culture name from a decimal lcid value) The mapping comes from this page: National Language Support (NLS) API Reference (Windows 7) Practically inside the library there is JSON object with the values and two methods to get them. The Culture name is the full one (for example en-US for 1033) you can slice the string if you need only the first two letters. You can find more information on my blog: |
|||
|