This post shows how to set up a SharePoint environment to explore the multilingual user interface (MUI).
I admit to being a typical American. When I write applications, I hardly ever use resource files to support any language other than English. My friend Derek Noonan sent me this map that makes me laugh (“Here be dragons!”) because it is painfully true… most Americans don’t speak a second language aside from knowing how to ask for another beer or directions to the bathroom.
I have seen demos of the SharePoint 2010 Multilingual User Interface, but I haven’t ever tried to make it work in my environment. I decided to configure it, document the installation process, and show some of the capabilities. If you are interested in learning more, see the For More Information section at the bottom of this post.
Even if you aren’t currently supporting multiple languages, I encourage you to understand the MUI and its capabilities. Some day you may find yourself with a task of supporting multiple languages, understanding the out of box capabilities can save you many hours of work.
I was a complete MUI novice, I wasn’t even sure what to install to make it work. It turns out to be pretty easy (albeit a bit time consuming) to set up MUI in SharePoint 2010. You do not need to install language packs for the operating system, you only need to install the SharePoint language pack for each language you want to support and SP1 for each language pack (and the latest CU).
To start with, my laptop probably looks just like yours. Its display language is English with no other display languages installed, and I installed SharePoint 2010 using the downloaded media from MSDN. I applied the latest updates (at the time of this writing, the latest service pack is SP1, and the latest Cumulative Update is August 2011 CU) and ran PSConfig. This is a typical developer machine that supports exactly 1 language: English. The steps are:
For 4 languages, that’s a total of 9 installations. Here is what my download folder looks like:
The first step is to download the language pack(s) for SharePoint 2010. The first time I tried this, I ended up installing the English language pack. Showing how typical of an American I am, a friend (thanks, Mads!) pointed out there is a drop-down that doesn’t just change the language of the web page you are looking at, but also changes which language pack you are going to download.
Once you select a language, download and install each language pack that you want to use. I chose French, German, Japanese, and Spanish language packs. When a language pack is completed, there is a checkbox asking you if you want to run the SharePoint Product Configuration Wizard (PSConfig). Uncheck this… we will run PSConfig later.
Once you install a language pack, you need to also install Service Pack 1 for Server Language Pack 2010 for each language pack that you installed. Just like with the previous download screen, you need to change the drop-down to the language that you want to download.
I already have August CU applied to my environment, but you should reapply the latest CU again after installing the language packs. When I tried to run the August CU again on my machine, the installer reported the hotfix was already installed. It can’t hurt to be thorough.
Notice how we didn’t say to run PSConfig yet? Thankfully, you can do all 9 installations first, and after all the installations are complete run PSConfig on each server in your farm.
To get started, create a site and access its site settings page. Choose Language Settings, and select which languages you want to allow the users to switch to.
Once you enable alternate languages, users will now have the option to change the display language.
I selected German, and the site changed to the following:
Let’s poke around and see what else is localized.
Now, you might be asking yourself, “what about content?” If a user types something in a wiki page, is that automatically translated? The answer here is no. You can experiment by creating a new site page and then editing it with some text. Change the site language, and the text remains the same. OK, understandable.
What about my code that displays strings, can it be localized? The answer here is a resounding yes. The .NET Framework provides extensive support for localization, as does SharePoint, but only when you leverage it. The code is very simple:
public class HelloMUIWebPart : WebPart
protected override void CreateChildControls()
Label hello = new Label();
hello.Text = "Hello";
Label localGreeting = new Label();
localGreeting.Text = Properties.Resources.Greeting;
Label currentUIculture = new Label();
currentUIculture.Text = "Current UI Culture: " + CultureInfo.CurrentUICulture;
Label date = new Label();
date.Text = "Date: " + System.DateTime.Now.ToString("d", CultureInfo.CurrentUICulture);
Label time = new Label();
time.Text = "Time: " + System.DateTime.Now.ToString("t", CultureInfo.CurrentUICulture);
The trick here is deploying the satellite assemblies. Build your project with your new resource files and add them to your Visual Studio 2010 project, following the steps in How to: Deploy Localized Sandboxed Solutions by Using Satellite Assemblies.
The English version of our page:
Change the site language to French, and compare the changes. The static string “Hello” remains un-localized, and the text that the user entered into the wiki page remains unaffected. However, the Greeting resource string is localized as are the date and time, according to the current UI culture.
Just for good measure, let’s change the site language to German to compare the changes.
How to: Deploy Localized Sandboxed Solutions by Using Satellite Assemblies
Walkthrough: Localizing a Web Part
Understanding the Multilingual User Interface (MUI)