SharePoint Custom Multilingual User Interfaces – Part 1

In my last post I took a look at how SharePoint 2010 can be made multilingual using Language Packs. This is great for anything out of the box, but what if like me you can’t help but customise and extend SharePoint! So the question is, how do offer this same ability to support multiple languages when we create custom solutions?

In this post I’m going to see how and when we can use resource files to allow our custom functionality to be available when users switch languages. For this example, I’m going to create a Contact us form as a SharePoint feature, which will contain a application page with various form inputs and a list to store the submissions. Not the most complicated feature but it will let me show you a number of different ways that different Resources can be included.
Before we start it’s worth taking a look at how and where SharePoint deploys Resource files. If you’d like a more indepth then this blog post from the Microsoft SharePoint Developer Team goes into a lot more detail. The short version is really that Resource files can exist in 3 different locations, depending on how they’re used and what uses them!

  • Feature Resource files – resource files are copied to 14TEMPLATEFEATURES{YOUR FEATURE}Resources. Used by elements like Feature Definitions, List Definitions etc, but only available within the Feature.
  • SharePoint Resource files - resource files are copied to 14/Resources and as such can be re-used across multiple Features within SharePoint.
  • App_GlobalResources - resource files are copied to wwwrootwssvirtualdirectory{YOUR SITE}App_GlobalResources. These resource files are used by more typically .Net (such as in markup) since it isn’t aware of the SharePoint resource files.

For Part 1 I’m just going to take a look at Feature Resource files and how they can be used and I’ll tackle (and finish the code example) in future post!
To begin with you’ll need to make sure your SharePoint supports multilingual, I’m working in English and French (Apologies for any mistakes in the translations!). If you haven’t got additional languages up and running yet, check out my first blog  (SharePoint Multilingual (MUI) Support) else you won’t be able to switch languages!

The only thing, start with an empty SharePoint project in Visual Studio 2010.

Feature Resource Files

Feature Definition

We’ll start with something straight- making the Feature name and description support multilingual. This is one area where using a Feature Resource file works really well as the name and description are really only relevant in the Feature and isn’t likely to be needed by anything else.

1) Right-click the Feature and ‘Add Feature Resource…’. This will bring up a dialog which will let you pick the culture for this file. Since this is my first resource file I’m going to leave it as ‘Invariant Language (Invariant Country)’ so this will be the default Resource file.
2) This should open up the Resources file which should look like this:
Visual Studio Empty Resources File

3) Now its just a case of filling in the Name (aka Keys, Ids) and Values, to begin with I’m just adding:
FeatureTitle – TSB Contact Us Form
FeatureDescription – Enables the contact us form

4) Now if we jump back to our Feature we can now change the Title and Description to the following: $Resources:FeatureTitle and $Resources:FeatureDescription

5) Now let’s deploy this feature and take a look at ‘Manage site features’. Hopefully you should see your feature listed, along with the text you provided in the Resource file!
TSB Contact Us Form Feature
6) Next step… adding another language! Jump back into Visual Studio and let’s add another resource file. When the culture dialog appears, this time I’m going to select ‘French (France)’. (Notice that this new Resource file is called

7) Now we need to add the same Names/Key in this resource file, but giving our French text instead for the Value:
FeatureTitle – TSB Nous Contacter
FeatureDescription – Permet nous contacter

8) Now let’s redeploy and take another look at ‘Manage site features’. Initially you should see the English text (or whatever you setup as the default) but if you switch to French (see last post on how to enable and switch) you should find the French text now appears.
TSB Nous contacter feature
Now we’ve got two languages setup you can repeat steps 6-8 for as many languages as you need. As long as you keep the Names in the resource file consistent they’ll be picked up. One thing to note is if an entry is missing in one of the resource files (say there was no FeatureDescription in the French resource file) then what you see in SharePoint is ‘$Resources:FeatureDescription’.

List Definition

Let’s take a look at another context that we can use the Feature Resource File – List Definitions. In our example we need a list to store all of our contact form submissions. Whilst the list data isn’t going to translated it would be good when people are viewing the list that the fields names are localised so that they know what they’re looking at.
1) Create a new List Definition in Visual Studio, I’m going to call it ContactUsResults and am basing it on the Custom List
2) Open the Elements.xml that was generated and find the DisplayName and Description and replace the values with: $Resources:ListTitle and $Resources:ListDescription


3) Now let’s open the Schema.xml and add a couple of fields. I’m going to add 3 text fields – Firstname, Surname and Comment. (You can repeat this code for each field and just change the DisplayName, StaticName, Name and ID!)


Notice that I’ve left StaticName and Name as static text, it’s only the DisplayName that I’ve changed. Since StaticName and Name are used internally by SharePoint, as well as custom code having them change would be a nightmare! As it is, normal users will only see the DisplayName – for example: List views, new/edit item forms, list settings etc. When we code against this list (like CAML queries) we still reference the field as ‘Firstname’ so we don’t directly have to be concerned with the language settings.

4) Now let’s add the following to each of our resource files:

Name Value (English) Value (French)
ListTitle Contact us Results Nous contacter résultats
Description List contains contact us submissions Liste contient contactez-nous soumissions
FormFirstname First name Prenom
FormSurname Surname Nom
FormComment Comments Commentaire

5) Let’s deploy and create a new list based on our template (Site Actions > View all site content > Create). If you switch between English and French you should find that the list definition changes it’s name and description when to try to create the list.

MUI List view
And that’s it! When we start adding data to the list the view switches the field names according to the language settings.


That’s a quick intro but it’s a good start for showing how you can use Feature Resource files to provide multiple languages for some of your custom development. The approach that’s used on the list definition also works on things like Content Types. With the examples we’ve looked at so far you might have noticed a couple of issues – like our Contact Us Results list, although the definition is multi-lingual the actual list that’s created has a fixed title. The next post we’ll start looking at some of things we can’t do with Feature Resource files and we’ll take a look at some of the others!

Leave a comment

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>