Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to add alternate languages (programmatically from JavaScript code)

$
0
0

Hi everyone, I have a sharepoint hosted app which create a subsite (Project site). Frist language must be German, but i must add two alternate languages English and Polish.

Code of function which create subsite

function addSite() {
    var appContextSiteCreate = new SP.AppContextSite(context, hostweburl);
    var subWeb = appContextSiteCreate.get_web();
    context.load(subWeb);
    var webCreationInformation = new SP.WebCreationInformation();
    webCreationInformation.set_title(subTitle);
    webCreationInformation.set_description(subDescription);
    webCreationInformation.set_language(1031); //LCID: 1031 is German , 1045 is Polish, 1033 is English
    webCreationInformation.set_url(subWebUrl);
    webCreationInformation.set_useSamePermissionsAsParentSite(false);
    webCreationInformation.set_webTemplate("PROJECTSITE#0");
    subWeb.get_webs().add(webCreationInformation);
    subWeb.update();

    context.load(subWeb);
    context.executeQueryAsync(function () {
        alert('Website "' + subTitle + '" created successfully.');

        createProjektProporties(); // this function add an list
        createProjektTeam();// this function add an another list
    },
        function (sender, args) {
            alert(args.get_message());
        });
}

How add to this code alternate languages?

Manually this is in settings -> language settings -> alternate language, and chose from the checkboxes.

I must do this programmatically.



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>