How to activate languages on all subsites using Powershell

Hi, If you ever find yourself wanting to enable a particular language or set of languages on a site Collection and all subsites, and if you do NOT want to enable all languages installed but rather Control what gets enabled? Here is a script that will help you.

# Enables SELECTED installed languages for each subsite in a site collection
 $spSiteURL = http://yoururlSitecollection
 $spSite = Get-SPSite -Identity $spSiteURL
 foreach ($spWeb in $spSite.AllWebs)
 {
   $spWeb.IsMultilingual = $true
   $WebRegionSettings = New-Object Microsoft.SharePoint.SPRegionalSettings($spWeb)
   foreach ($language in $WebRegionSettings.InstalledLanguages)
   {
     If ($language.DisplayName -eq "English" -or $language.DisplayName -eq "Spanish")
     # Add the displayname of any langauge you have installed: -or $language.DisplayName -eq "Spanish"
     {
        write-host -BackgroundColor Green -ForegroundColor Black "Update -" $spWeb "site with LCID:" $language.DisplayName
        $culture = New-Object System.Globalization.CultureInfo($language.LCID)
        $spWeb.AddSupportedUICulture($Culture)
     }
     else
     {
        Write-host " Language not activated: " $language.DisplayName " on site " $spWeb.Name
     }
   }
   $spWeb.Update()
 }

Hope that helps!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s