Sample SharePoint project localization Part 2 of 2


This article assumes you are already familiar with Part 1 and the post preceding it.

Here, we discuss how to localize the content of the SharePoint custom web site project you already have created.

Normally, your ASPX page content would be similar to the following:

We want those ‘hardcoded’ strings to be localization enabled.

1. Create your default resource file.
You can create a subfolder ‘Resources’ in your project and put it there. Give it a specific name, in our case it is SampleLocalization.resx

2. Extract the strings we want to localize, into a resource file.
Let’s assume we want to have the page title, button text and greeting message localized. We need to create a resource entry for each one of them. Your resource file should look similarly to:

3. Modify the Page attribute to contain Culture and UICulture tags.
It should be similar to:

Inherits=”SampleCode.Localized, SampleCode, Version=, Culture=neutral, PublicKeyToken=[Public Key Token]” Culture=”auto” UICulture=”auto” %>

4. Modify your page to refer to the resources, rather than the hardcoded strings

5. Make a copy of your resource file. This will be our second language. Let’s make it Bulgarian.
Name it ‘’. Open it for editing and translate the text. For your convenience, here are the strings:

Button_Text – Бутон текст
Greeting – Здравейте, това е тест
Page_Title – Това е заглавието на страницата

Make sure you store it in the Resources folder, next to your SampleLocalization.resx file.

6. web.config modification
Open the web.config of the website that hosts your template page. Find (or add) your globalization node and modify it to contain Culture and UICulture attributes, equaling ‘auto’.

7. Deployment
Do a full deploy of your project. Also, don’t forget to copy your *.resx files (both of them) into the WSS VirtualDirectories App_GlobalResources. The path usually is:

C:\Inetpub\wwwroot\wss\VirtualDirectories\[Port Number]\App_GlobalResources

Open the web page in the browser and see the result. You can set language preference through the settings of your browser.

For IE:
Tools -> Internet Options -> General Tab -> Languages -> Add / Move Up / Move Down

For FF:
Tools -> Options -> Content tab -> Languages (bottom) Choose button -> Add / Move Up / Move Down

Add Bulgarian. Try how it works when Bulgarian is a first preference, or when it is last.

In English:

In Bulgarian:

Hope this is helpful,
Hristo Yankov


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: