Change the language settings on every mysite

Running a SharePoint Site with different languages? No problem!
But making sure every user has the correct language settings? Maybe a problem.

So why don't using Powershell?


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
 # Enables SELECTED installed languages for each subsite in a site collection
 $webAppURL = "https://mysiteurl/"
 $webApp = Get-SPWebApplication $webAppURL
 
 foreach ($spSite in $webApp.Sites){
  $spWeb = $spSite.RootWeb
  $spWeb.IsMultilingual = $true
  $WebRegionSettings = New-Object Microsoft.SharePoint.SPRegionalSettings($spWeb);
  
  foreach ($language in $WebRegionSettings.InstalledLanguages) {
   If ($language.DisplayName -eq "English" -or $language.DisplayName -eq "German") {
    # Add the displayname of any langauge you have installed: -or $language.DisplayName -eq "Norwegian" -or $language.DisplayName -eq "Finnish" -or $language.DisplayName -eq "Danish"
    
    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() 
 }
})


Comments

Popular posts from this blog

How to support multiple languages in WPF