Tuesday, March 26, 2013

PowerShell Script to Enable Alternate Language(s) in SharePoint 2010

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.

Monday, March 25, 2013

Alternate language(s) in SharePoint 2010

Alternate languages feature (also called Multilingual User Interface - MUI) in SharePoint 2010 allows a logged on user to change the language to one of the supported alternate languages configured by the site administrator. Therefore with Alternate languages configured, when a user accesses a page, the language actually used will depend on the preferred language in user's browser. So if browser's preferred language is English, we can see 'lang="en-us"' in the page source.


When user switch between languages, following UI elements will be translated (but not site content):
  • Ribbon
  • Site Actions Menu
  • Site Settings Page
  • Lists and Site Column headers
  • Quick Launch Menu
  • Certain Messages displayed in out of the box Webparts
Configure alternate languages:
1. Install required language packs.

2. Go to Site Settings -> Language settings under Site Administration (Language settings option will not be shown if the language packs are not installed.)

3. Based on the language packs installed, we can see a list of languages in Language settings page under Alternative Language(s) section. Select required languages.


4. That’s it. Now a logged on user can switch between languages and UI elements will be translated accordingly.


5. Once the alternative languages selected, there will be two new options coming in the Site Settings page of the site under Site Administration section. Export Translations and Import Translations.


Site administrator can use Export Translations page to export the resource file of a specified language.


Then the translations can be changed as required and translated resource files can be imported back to the site using Import Translations option.

Friday, March 8, 2013

Create an E-mail Distribution Group – SharePoint 2010

Setting up email distribution group allows us to send email to members of a SharePoint group. By default E-Mail Distribution List option is not available in Group Settings section of the groups.

Therefore in order to setup Distribution Emails, first we need to configure incoming email settings in the central administration.


In there we can enable distribution group creation by going with following selection.
  • Select Yes for ‘Use the SharePoint Directory Management Service to create distribution groups and contacts?’ option.
  • Then select Yes for ‘Allow creation of distribution groups from SharePoint sites?’ option.

That’s it! If we navigate to site collection root web, E-Mail Distribution List section will appear in permission group settings.

Navigate Site Settings -> Site Permissions. For each required user group, navigate to Group Settings.


Under E-Mail Distribution List, select Yes for create an e-mail distribution group option and provide the email address for the distribution group created in the active directory.


Note: All necessary Distribution groups should have being created in the active directory and proper email addresses should have being obtained to follow above steps. Also Outgoing E-mail should be configured on each required web application.