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)

4 Answers 4


You can create a JS object and fetch the values using the LCID:

var CultureNames = { 1033:"en", 1036:"fr" };//Store it in a utility file somewhere.

var currentCultureName = CultureNames[SP.Res.lcid]; //will return 'en' if current culture is english.
  • To avoid having to keep a utility file around, I eventually used javascript to read the 'lang' attribute of the 'html'-tag. With a substring I can get 'en' out of 'en-us'. The reason I did this is that I have another library which keeps languages but in the two-letter format. It's a bit silly to keep two such repositories. Now I just hope that SharePoint will continue to mention that attribute. Nov 2, 2012 at 13:42

You can also do:


Sys.CultureInfo.CurrentCulture is the server CurrentUICulture in JSON.

This is created by the page's ScriptManager and to it be available you need to set its property EnableScriptGlobalization to true.

I think this is enabled by default in SharePoint.


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:

LCID JavaScript Helper Library


In SharePoint 2013 JSOM API you could utilize SP.ServerSettings.getGlobalInstalledLanguages Method to retrieve all the installed languages, like this:

function getInstalledLanguages(success,error) 
    var ctx = new SP.ClientContext.get_current();
    var languages = SP.ServerSettings.getGlobalInstalledLanguages(ctx,15);

and then find the corresponding language by lcid:

         var lcid = parseInt(SP.Res.lcid);  //get current locale
         var language = languages.filter(function(l) {
                          return l.get_lcid() === lcid; 
         var langTag =  language.get_languageTag();   
         var langCode = langTag.split('-')[0];          

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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