MUI setting is a
web level setting and it cannot be set in the site collection level. Therefore
enable multilingual user interface manually for a big site collection is a
tedious job. (More information on Alternate Language(s) in SharePoint 2010 ishere.)
Following
PowerShell script automates the task by setting SPWeb.IsMultilingual
property in the specified Web and in it’s all sub Webs. In addition it checks
for the installed languages on the server farm and add them to the list of
alternative languages supported by the website's multilingual user interface.
# Enable alternate English language for all sub-sites
function
EnableAlternateLanguageForAllSubWebs([Microsoft.SharePoint.SPWeb] $web)
{
$installed =
[Microsoft.SharePoint.SPRegionalSettings]::GlobalInstalledLanguages
$subwebs = $web.GetSubwebsForCurrentUser()
foreach($subweb in $subwebs)
{
$subweb.IsMultiLingual
= $true;
$supportedCultures
= $subweb.SupportedUICultures;
foreach
($lang in $installed)
{
$cultureinfo =
[System.Globalization.CultureInfo]::GetCultureInfo($lang.LCID);
$exists = $supportedCultures
| Where-Object{$_.LCID -eq $lang.LCID}
if ($exists -eq $null)
{
$subweb.AddSupportedUICulture($cultureinfo)
Write-Host "Added" $cultureinfo.Name "to URL" $subweb.Url
}
}
$subweb.Update()
}
}
$web = Get-SPWeb "http://ca.nav.com/texas/"
$DebugPreference
= "Continue"
If ($web -ne $null)
{
EnableAlternateLanguageForAllSubWebs
$web
}
It should be noted
that exception will be thrown, if the SPWeb.IsMultilingual
property is set to ‘true’ on a website where;
- Website has customized CSS files.
- Website based on a template that does not support a multilingual user interface.
Note:
C# script for
adding alternate language support is illustrated in the MSDN in article: Understandingthe Multilingual User Interface here.