Search code examples
sharepointsharepoint-jsom

How to get the available languages of the current web of SharePoint from webpart?


fuction getLanguage(){ var context =new SP.ClientContext(hostUrl); var web = context.get_web(); context.load(web); context.executeQueryAsync( function (sender, args) { var lcid = web.get_language(); }, function (sender, args) { }); }

enter image description here


Solution

  • EDIT: if you want the web's available languages you have to load the property SupportedUILanguageIds which will give you that.
    Here is a link to the documentation
    If you want the user's languages you have to get the SPS-MUILanguages from the user profile.
    Here is some documentation on how the user profile api works documentation here
    Hope that helps.