Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to get the display language from within ECMAScript? Similar to http://www.sharepointoverflow.com/questions/3129/get-the-current-ui-language-from-a-webpart, I'd like to get the user's display language, however I want to access it with the Client Object Model in JavaScript (http://msdn.microsoft.com/en-us/library/ee538253.aspx). Is it somehow possible to access the System.Threading namespace? Or are there any other possibilities?

share|improve this question

3 Answers 3

up vote 20 down vote accepted

You have two easy ways to get the LCID in SP JavaScript

  1. var lcid =_spPageContextInfo.currentLanguage;
  2. var lcid = SP.Res.lcid;

Note that option 1 returns an int (i.e. 1033) and option 2 return a string (i.e. "1053").

share|improve this answer
Great, thanks a lot Wictor! Both are working perfectly! –  Modery Nov 10 '10 at 14:42
Great, Wictor! Is it possible to convert lcid to culture name in javascript? like 1033-> en-us, 1053 -> sv-se? –  Anatoly Mironov Feb 16 '12 at 15:44
Another option is to directly use the 'L_Menu_LCID' variable in page. More here: vrdmn.blogspot.in/2011/08/… –  Vardhaman Deshpande Oct 29 '12 at 16:54

In my case I needed to know the language before the SharePoint javascript libraries are loaded in order to hide elements before they are shown on the screen (not possible with _spBodyOnLoadFunctionNames).

Turns out SharePoint sets the lang attribute of the root HTML element according to the language and as a bonus it's already translated to the "en-us" format.

This is done with a simple call to document.getElementsByTagName('html')[0].getAttribute('lang')

share|improve this answer

Yet another ways to determine LCID in SP via JavaScript

1 Global variable g_wsaLCID:

var lcid = g_wsaLCID;

2 Language property of Web client object via CSOM (JavaScript)

function getWebLocale(complete) {

    var context = SP.ClientContext.get_current();
    var web = context.get_web();

                function(sender, args){
                    var lcid = web.get_language(); //returns LCID
                    return complete(lcid); 
                function(sender, args){

function printWebLanguageSettings(){ 
SP.SOD.executeOrDelayUntilScriptLoaded(printWebLanguageSettings, 'sp.js');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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