3

I am creating SharePoint 2013 sites using JavaScript (JSOM). I want to set alternate languages (languages already installed in farm) with JSOM, is it possible?

1

Pass the Language ID parameter to the below method sets the language of the new site SP.WebCreationInformation.set_language( <Language Id> );



createWebsite(1045);
function createWebsite(languageId) {

var clientContext = SP.ClientContext.get_current();
this.oWebsite = clientContext.get_web();

var webCreationInfo = new SP.WebCreationInformation();
webCreationInfo.set_title('My 1045 website');
webCreationInfo.set_description('Description of new Web site...');
webCreationInfo.set_language(languageId);
webCreationInfo.set_url('My1045WebSite');
webCreationInfo.set_useSamePermissionsAsParentSite(true);
webCreationInfo.set_webTemplate("STS#0");

oWebsite.get_webs().add(webCreationInfo);
oWebsite.update();

clientContext.executeQueryAsync(function() {
            console.log("Done");
            }, function(sender,args) { 
            console.log("failed. Message:" + args.get_message());
        });
}


I have listed the language ID below,

Locale ID - Language
1025 - Arabic
1068 - Azerbaijani
1069 - Basque
5146 - Bosnian (Latin)
1026 - Bulgarian
1027 - Catalan
2052 - Chinese (Simplified)
1028 - Chinese (Traditional)
1050 - Croatian
1029 - Czech
1030 - Danish
1164 - Dari
1043 - Dutch
1033 - English
1061 - Estonian
1035 - Finnish
1036 - French
1110 - Galician
1031 - German
1032 - Greek
1037 - Hebrew
1081 - Hindi
1038 - Hungarian
1057 - Indonesian
2108 - Irish
1040 - Italian
1041 - Japanese
1087 - Kazakh
1042 - Korean
1062 - Latvian
1063 - Lithuanian
1071 - Macedonian
1086 - Malay
1044 - Norwegian (Bokmål)
1045 - Polish
1046 - Portuguese (Brazil)
2070 - Portuguese (Portugal)
1048 - Romanian
1049 - Russian
10266 - Serbian (Cyrillic, Serbia)
9242 - Serbian (Latin, Serbia)
1051 - Slovak
1060 - Slovenian
3082 - Spanish
1053 - Swedish
1054 - Thai
1055 - Turkish
1058 - Ukrainian
1066 - Vietnamese
1106 - Welsh

  • This is for setting default language of the site, but I'm trying to add alternate languages. – Alfonso Feb 11 '16 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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