As I said earlier articles, during the deployment we need to do a series of actions. As part of that, let us see, how to enable the multi-language settings and select the languages.
The settings in the screen is available on the Site Settings.
Now, let us see the code, which will enable and select few languages as alternate languages.
using Microsoft.SharePoint.Client;
namespace Office365.Console
{
class Program
{
static void Main(string[] args)
{
ConfigureSearchCentreURL();
}
public static void ConfigureSearchCentreURL()
{
OfficeDevPnP.Core.AuthenticationManager authMgr = new OfficeDevPnP.Core.AuthenticationManager();
string sourceSiteUrl = "https://******.sharepoint.com/sites/communitysite";
string userName = "Sathish@******.onmicrosoft.com";
string password = "******";
var clientContext = authMgr.GetSharePointOnlineAuthenticatedContextTenant(sourceSiteUrl, userName, password);
Web web = clientContext.Web;
clientContext.Load(web);
web.IsMultilingual = true;
web.AddSupportedUILanguage(1033); // English
web.AddSupportedUILanguage(1031); // German
web.AddSupportedUILanguage(1036); // French
web.AddSupportedUILanguage(1046); // Portugese (Brazil)
web.AddSupportedUILanguage(1049); // Russian
web.AddSupportedUILanguage(2052); // Chinese (Simplified)
web.AddSupportedUILanguage(3082); // Spanish
web.Update();
clientContext.ExecuteQuery();
}
}
}
Happy Coding,
Sathish Nadarajan.
Leave a comment