Update: I updated the script to check whether a specific site support multilingual capabilities using the SupportsMultiLingualUI property of a webtemplate – see SharePoint 2010 Meeting Workspaces and Blogs are not MUI capable .
Yesterday I talked about how the SharePoint 2010 Multilingual User Interface feature allows for multilingual collaboration scenario’s without the need for additional third party addons. One of the things which bugged me though is that you need to enable the multilingual feature on a per site basis. So I wrote this little powershell script to activate the multilingual feature for all sites in a site collection and to add a specific alternate language (in my case French). You can use this as a starting point for your own powershell scripts…
1: if($args) {
2: $siteUrl = $args[0]
3:
4: $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
5: if ($snapin -eq $null)
6: {
7: Write-Host "Loading Microsoft SharePoint Powershell Snapin"
8: Add-PSSnapin "Microsoft.SharePoint.Powershell"
9: }
10:
11: $cultureinfo = new-object system.globalization.cultureinfo("fr-FR")
12:
13: $site = get-spsite $siteurl
14: $site.allwebs | foreach {
if ($_.WebTemplate.SupportsMultilingualUI){
$_.IsMultiLingual= 'True'
15: $_.AddSupportedUICulture($cultureinfo)
16: $_.Update()
17: }
18: }
19: $site = get-spsite $siteurl
20: $site.allwebs |foreach {Write-Host $_.Title + " " + $_.IsMultiLingual}
21:
22: }
23: else
24: {
25: Write-Host "ERROR: You must supply SiteCollection URL as parameter when calling ActivateLanguages.ps1"
26: }
I also uploaded the powershell script to the SharePoint Extensions Codeplex project – SharePoint 2010 Powershell Snippets
Just wondering...shouldn't you call dispose on the SPSite objects after you used them?
ReplyDelete