Steps to retrieve alternative languages from language settings in SharePoint online using JavaScript object model?

Steps to retrieve alternative languages from language settings in SharePoint online using JavaScript object model?

Here we will discuss how we can retrieve alternative languages from language settings in SharePoint online using JavaScript object model. You can see the alternative languages from Site settings -> language settings which are under Site Administration.

If you want to retrieve using Rest API, then you can follow this article.

It shows like below:

Steps to retrieve alternative languages from language settings in SharePoint online using JavaScript object model?
Steps to retrieve alternative languages from language settings in SharePoint online using JavaScript object model?

For this particular post, I have added the below code inside a script editor web part.

Remember it will display like for the English language it will return 1033.

Also you can read:
Steps to create custom timer job in SharePoint 2016 using Visual Studio 2015

Add use custom action to list ECB menu in SharePoint Online using JavaScript object model

Start a task process workflow action Nintex workflow for office 365 SharePoint Online

<input type=”button” id=”btnGetLanguages” value=”Click Here”/>

<script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js”></script>

<script>

$(document).ready(function(){

$(“#btnGetLanguages”).click(function(){

GetLanguages();

});

});

var web;

function GetLanguages(){

alert(‘Hello world’);

var clientContext = new SP.ClientContext();

web=clientContext.get_web();

clientContext.load(web,”SupportedUILanguageIds”);

clientContext.executeQueryAsync(Function.createDelegate(this, this.onSuccess),

Function.createDelegate(this, this.onFailure));

}

function onSuccess() {

var supportedlanguage = web.get_supportedUILanguageIds();

for (var i = 0; i < supportedlanguage.length; i++) {

var languageName = supportedlanguage[i].toString();

alert(languageName);

}

}

function onFailure(sender, args) {

alert(‘Error Occurred. ‘ + args.get_message());

}


</script>

Hope this will be helpful.


You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →