Skip to main content

Posts

Showing posts with the label Current user Language

Change Language for current user with JSOM in SharePoint Online

Hi,

Here is code which can change language for current user with JSOM :


<script type="text/javascript" charset="utf8" src="/sites/BizDev/Style%20Library/SPS/jquery-1.11.3.min.js"></script>
<select id='LangSelect' onchange="SetUserLanguage(this.value);"></select>

<script type="text/javascript">

function SetUserLanguage(lCode)
{
    var call = $.ajax({
            url: _spPageContextInfo.siteAbsoluteUrl + "/_api/Web/Lists/GetByTitle('Languages')/items?" + "$select=Title,Code,LCode,ID&$top=5000&$filter=Code eq "+lCode,
            type: "GET",
            dataType: "json",
            headers: {
                Accept: "application/json;odata=verbose"
            }
        });

        call.done(function (data, textStatus, jqXHR) {
            var multipleValues = [];
            for (var i=0;i<data.d.results.length;i++){
                console.log(da…