Sharep10nt

All About SharePoint 2010/2013

  Home  |   Contact  |   Syndication    |   Login
  23 Posts | 0 Stories | 0 Trackbacks

News

Exploring SharePoint 2013 Online

Developing Nintex Workflows

Exploring SharePoint 2013

Acquired MCPD : SharePoint 2010 Developer

Share on Facebook

Archives

Post Categories

What is Localization/Multilingual and Globalization?
The term "Localization" defined as "Process of translating resources for a specific culture/languages", where "Globalization" defined "Process of designing applications that can adapt to different cultures/languages". When we publish a site for different regions then it'll be great if the site content is displayed in that regional language. SharePoint provides Language Packs which can be downloaded and installed from Microsoft Site. but the limitation in this is only the SharePoint site labels/text will be displayed in selected language and the user defined contents won't be translated by SharePoint.

How to enable Localization in SharePoint 2010?
Assume we develop a webpart that has a registration form. A user from German wish to register and he needs the form in German/Dutch language. Even though Dutch language pack installed and enabled in SharePoint, the webpart text won't be translated/displayed in German. So how to make webpart that can adapt different languages. For those working in .Net platform knows it can be done with Resource files (.resx). Resource files are nothing but Key/Value Pair defined XML format files.

Here the steps to create a Webpart that detects the selected language in SharePoint and display contents that fetched from Resource Files.
 

  1. Open Visual Studio 2010 -> File -> New -> Project
     
  2. Select [Template] Visual C# -> SharePoint -> 2010 [Framework] .Net Framework 3.5 [Project] -> Empty SharePoint 2010 Project. Name of the Project : vsProject
    New Empty SharePoint Project

     
  3. In the SharePoint Customization Wizard, enter the URL of the local site (http://vsnet/) and select Deploy as a farm solution.
    Deploy as Farm Solution

     
  4. Create Resource Files
    1. Resource files should be present in SharePoint Root "Resources" folder. In Solution Explorer select project "vsProject", right click and select Add -> SharePoint Mapped Folder.
      Add SharePoint Mapped Folders

       
    2. In the Window select "Resources" Folder.
      Add "Resources" Folder

       
    3. Now an empty "Resources" folder is created inside SharePoint project. Any files placed inside this folder will be copied to SharePoint Root (14)\Resources Folder while deploying.
       
    4. Right click on Resources folder and select Add -> New Folder -> vsProject [Folder Name]. Always create folder and place files. This will avoid the files getting deleted when any SharePoint service pack installed.
    5. Right click on Newly created folder [vsProject] and select New -> New Item.
       
    6. In the New Item window select [Template] Visual C# -> General -> Resources File -> Name the files as "vsProject.resx". This is for default language which in English (LCID : 1033).
      New Resource File

       
    7. Select vsProject.resx file, right click and Open.
       
    8. Add Name and Value pairs as required.
      Add Name/Value Pairs

       
    9. Repeat Step "f." and provide name "vsProject.de-DE.resx". This file is for Dutch language. Refer the end of the article to get full list.
      Add New Resource File

       
    10. Open "vsProject.de-DE.resx" and enter the same Name as in vsProject.resx and provide value in German Language. Here "Comment" Field is optional.
      German/Dutch Language Name/Value Pair

       
  5. Create Webpart
    The Resource file is ready to use and now need to create Web part that get value from those resource files.
    1. Right Click on the Project "vsProject" and "Add -> New Item"
    2. Select "Visual C# -> SharePoint -> 2010 -> Web Part". Name : "LocalizationDemo".
      Add New Web Part

       
    3. Copy paste the below code inside LocalizationDemo class or just refer it.
      protected override void CreateChildControls()
      {
        int intLCID = System.Threading.Thread.CurrentThread.CurrentUICulture.LCID;
        Label lblWelcomeText = new Label();
        lblWelcomeText.Text =
      "Value : " + getLocalizedValue("WelcomeText", intLCID);
        this.Controls.Add(lblWelcomeText);
      }


      public string getLocalizedValue(string strInput, int intLCID)
      {
        // Function to retreive specified Language Variation Value
        string strLocalizedValue = "";

        strLocalizedValue = Microsoft.SharePoint.Utilities.
      SPUtility.GetLocalizedString("$Resources: " + strInput, "vsProject\\vsProject", (uint)intLCID);

        return
      strLocalizedValue;
      }

       
    4. Save all files, Build and Deploy. The solution will be deployed in SharePoint and ready to use.
       
    5. Open the SharePoint site any page and click "Edit" Icon on top (or Site Actions -> Edit page).
       
    6. Select "Editing Tools [Tab] -> Insert [Tab] -> Web Part -> Custom [Categories] -> LocalizationDemo -> Add [Button]".
      Add the Web Part to SharePoint Page

       
    7. Once the webpart added to the page select "Save and close" Icon.
  6. Now it'll show the content in default language (English - 1033). Select "User Menu" at top right and select "Select Display Language -> Deutsch".
  7. The page will be refreshed the Web Part will show the German Content which specified in the resource file.
    Localization English and After changing language to Deutsch

Reference List - Locale ID (LCID) and Language

 

HTTP

LCID

Language

 

1033

Default

af

1078

Afrikaans

sq

1052

Albanian

ar-sa

1025

Arabic(Saudi Arabia)

ar-iq

2049

Arabic(Iraq)

ar-eg

3073

Arabic(Egypt)

ar-ly

4097

Arabic(Libya)

ar-dz

5121

Arabic(Algeria)

ar-ma

6145

Arabic(Morocco)

ar-tn

7169

Arabic(Tunisia)

ar-om

8193

Arabic(Oman)

ar-ye

9217

Arabic(Yemen)

ar-sy

10241

Arabic(Syria)

ar-jo

11265

Arabic(Jordan)

ar-lb

12289

Arabic(Lebanon)

ar-kw

13313

Arabic(Kuwait)

ar-ae

14337

Arabic(U.A.E.)

ar-bh

15361

Arabic(Bahrain)

ar-qa

16385

Arabic(Qatar)

eu

1069

Basque

bg

1026

Bulgarian

be

1059

Belarusian

ca

1027

Catalan

zh-tw

1028

Chinese(Taiwan)

zh-cn

2052

Chinese(PRC)

zh-hk

3076

Chinese(Hong Kong)

zh-sg

4100

Chinese(Singapore)

hr

1050

Croatian

cs

1029

Czech

da

1030

Danish

n

1043

Dutch(Standard)

nl-be

2067

Dutch(Belgian)

en

9

English

en-us

1033

English(United States)

en-gb

2057

English(British)

en-au

3081

English(Australian)

en-ca

4105

English(Canadian)

en-nz

5129

English(New Zealand)

en-ie

6153

English(Ireland)

en-za

7177

English(South Africa)

en-jm

8201

English(Jamaica)

en

9225

English(Caribbean)

en-bz

10249

English(Belize)

en-tt

11273

English(Trinidad)

et

1061

Estonian

fo

1080

Faeroese

fa

1065

Farsi

fi

1035

Finnish

fr

1036

French(Standard)

fr-be

2060

French(Belgian)

fr-ca

3084

French(Canadian)

fr-ch

4108

French(Swiss)

fr-lu

5132

French(Luxembourg)

mk

1071

FYRO Macedonian

gd

1084

Gaelic(Scots)

gd-ie

2108

Gaelic(Irish)

de

1031

German(Standard)

de-ch

2055

German(Swiss)

de-at

3079

German(Austrian)

de-lu

4103

German(Luxembourg)

de-li

5127

German(Liechtenstein)

e

1032

Greek

he

1037

Hebrew

hi

1081

Hindi

hu

1038

Hungarian

is

1039

Icelandic

in

1057

Indonesian

it

1040

Italian(Standard)

it-ch

2064

Italian(Swiss)

ja

1041

Japanese

ko

1042

Korean

ko

2066

Korean(Johab)

lv

1062

Latvian

lt

1063

Lithuanian

ms

1086

Malaysian

mt

1082

Maltese

no

1044

Norwegian(Bokmal)

no

2068

Norwegian(Nynorsk)

p

1045

Polish

pt-br

1046

Portuguese(Brazil)

pt

2070

Portuguese(Portugal)

rm

1047

Rhaeto-Romanic

ro

1048

Romanian

ro-mo

2072

Romanian(Moldavia)

ru

1049

Russian

ru-mo

2073

Russian(Moldavia)

sz

1083

Sami(Lappish)

sr

3098

Serbian(Cyrillic)

sr

2074

Serbian(Latin)

sk

1051

Slovak

s

1060

Slovenian

sb

1070

Sorbian

es

1034

Spanish(Spain - Traditional Sort)

es-mx

2058

Spanish(Mexican)

es

3082

Spanish(Spain - Modern Sort)

es-gt

4106

Spanish(Guatemala)

es-cr

5130

Spanish(Costa Rica)

es-pa

6154

Spanish(Panama)

es-do

7178

Spanish(Dominican Republic)

es-ve

8202

Spanish(Venezuela)

es-co

9226

Spanish(Colombia)

es-pe

10250

Spanish(Peru)

es-ar

11274

Spanish(Argentina)

es-ec

12298

Spanish(Ecuador)

es-c

13322

Spanish(Chile)

es-uy

14346

Spanish(Uruguay)

es-py

15370

Spanish(Paraguay)

es-bo

16394

Spanish(Bolivia)

es-sv

17418

Spanish(El Salvador)

es-hn

18442

Spanish(Honduras)

es-ni

19466

Spanish(Nicaragua)

es-pr

20490

Spanish(Puerto Rico)

sx

1072

Sutu

sv

1053

Swedish

sv-fi

2077

Swedish(Finland)

th

1054

Thai

ts

1073

Tsonga

tn

1074

Tswana

tr

1055

Turkish

uk

1058

Ukrainian

ur

1056

Urdu

ve

1075

Venda

vi

1066

Vietnamese

xh

1076

Xhosa

ji

1085

Yiddish

zu

1077

Zulu

posted on Tuesday, December 14, 2010 3:22 PM

Feedback

# re: How to Create Multilingual Webpart in SharePoint 2010? 12/14/2010 4:29 PM Venkatesh
For Install Language Pack in SharePoint 2010 Refer http://geekswithblogs.net/venkatx5/archive/2010/12/01/how-to-install-language-pack-in-sharepoint-2010.aspx

# re: How to Create Multilingual Webpart in SharePoint 2010? 12/29/2010 6:54 PM Christoph
Thanks for your post.

Just want to mention: Dutch != German language.

Germans are talking German, Dutch people are people from Netherland, they speak Dutch!

# re: How to Create Multilingual Webpart in SharePoint 2010? 12/30/2010 9:15 AM Venkatesh
Hi Cristoph,
I was in German(Nurnberg, Bavaria) for a month. They mostly call the language as "Dutch". But I agree German is Not Dutch.
SharePoint shows "German" under "Deutsch". :)

# re: How to Create Multilingual Webpart in SharePoint 2010? 1/10/2011 6:16 PM Glen
I think SharePoint is a very good idea. better than looking for a content writer for every language

# re: How to Create Multilingual Webpart in SharePoint 2010? 3/20/2011 8:52 PM Dennis Skrtic
Venkatesh,

Thanks for your post. Works well and very easy to follow.

Do you have an easy way to localize the text (labels and help text) for the custom web part properties? Some of the methods I've found browsing the web seem a bit complex and don't seem to work very well.

Thanks!
Dennis

Thanks!
Dennis

# re: How to Create Multilingual Webpart in SharePoint 2010? 5/12/2011 3:08 PM Aliaksandr
Great article! Thanks

# re: How to Create Multilingual Webpart in SharePoint 2010? 5/21/2011 10:06 PM Manjunath Reddy
How to create language selection menu in site actions..

# re: How to Create Multilingual Webpart in SharePoint 2010? 6/21/2011 10:23 PM Muhammad Kazim
Thank You so much , it really helped me alot , i used your sharings in my blog too , Thanks.

# re: How to Create Multilingual Webpart in SharePoint 2010? 7/13/2011 10:25 AM Mark van Lunenburg
Hi,

Great post.
One point of feedback: Dutch is not German :) Dutch is The Netherlands / Holland. We have to many different names :)
The culture ID should be nl-NL.

Thanks again.
Mark

# re: How to Create Multilingual Webpart in SharePoint 2010? 10/23/2011 6:18 PM Ben
You obvisouly don't know the difference between Dutch and German (Deutsch)!

# re: How to Create Multilingual Webpart in SharePoint 2010? 11/4/2011 3:51 PM Enzo_Shi
nice job

# re: How to Create Multilingual Webpart in SharePoint 2010? 12/9/2011 5:54 PM Maarten
Great tutorial and thanks for the Reference List!

One note: de-DE is the format for the German language, not the Dutch.

nl and nl-BE represent the Dutch language

# re: How to Create Multilingual Webpart in SharePoint 2010? 12/19/2011 8:26 PM Arie
Dutch, German ... what is what.

# re: How to Create Multilingual Webpart in SharePoint 2010? 3/7/2012 10:00 PM Aditya
Hi All

The resources are working fine in Internet Explorer but when in firefox the page is giving Input string was not in correct format .Please help

# re: How to Create Multilingual Webpart in SharePoint 2010? 6/26/2012 2:31 PM Gas Patio Heaters
Dutch is The Netherlands / Holland. We have to many different names :)
The culture ID should be nl-NL.

# re: How to Create Multilingual Webpart in SharePoint 2010? 8/13/2012 6:37 PM Vinit
Hi,
Very nice post,but 1 issue i am facing is when i select Dutch from "Select display language" option my value doesnot change from english language to dutch.
Can anyone please help in this

# re: How to Create Multilingual Webpart in SharePoint 2010? 8/13/2012 6:43 PM Venkatesh
@Vinit : SharePoint will pass the selected language code to webpart to display. Just re-install Language pack and try.
http://geekswithblogs.net/venkatx5/archive/2010/12/01/how-to-install-language-pack-in-sharepoint-2010.aspx

# re: How to Create Multilingual Webpart in SharePoint 2010? 8/14/2012 3:30 PM Riya
Very precise and crisp description of the process. Very helpful!

# re: How to Create Multilingual Webpart in SharePoint 2010? 8/22/2012 7:13 PM Sampad
Great article. I was exactly looking for this approach. Thanks a ton!! :)

# re: How to Create Multilingual Webpart in SharePoint 2010? 1/8/2013 8:03 PM Uttam
strLocalizedValue = Microsoft.SharePoint.Utilities.SPUtility.GetLocalizedString("$Resources: " + strInput, "vsProject\\vsProject", (uint)intLCID);
i have a problem here i have french standard language pack deployed and following your approach. i have created a site collection with french and another with English.
when i write this code then i get in result as $Resources:string1 but i wrote a code to check the current LCID so if it is Englisjh
strLocalizedValue = Microsoft.SharePoint.Utilities.SPUtility.GetLocalizedString("$Resources: " + strInput, "vsProjectEn", (uint)intLCID);

else
strLocalizedValue = Microsoft.SharePoint.Utilities.SPUtility.GetLocalizedString("$Resources: " + strInput, "vsProject.fr", (uint)intLCID);

but how can the webpart automatically display in french do i have to write this code to display in different language.
also how can i reference the resources string in aspx file.
such as like
<asp:label id="lbl1" text="resources"/>
Do i have to check the current language of the site to display in different language or it chhoses automatically the display language.
Please Help

# re: How to Create Multilingual Webpart in SharePoint 2010 using sandbox solution 1/24/2013 11:10 AM Zeeshan
Hi,thanx fr the help.I have a sandbox solution and I am not able to do the same with it..Kindly help with the steps in sandbox solution

# re: How to Create Multilingual Webpart in SharePoint 2010? 1/24/2013 9:33 PM Venkatesh
@Zeeshan : Via Sandbox solution, you can't deploy files in ISAPI/14 Folder. Please revert what's the exact issue you are facing.

# re: How to Create Multilingual Webpart in SharePoint 2010? 2/12/2013 1:23 PM Ars
Hi. how can I after deployment edit labels etc manually without visual studio?

# re: How to Create Multilingual Webpart in SharePoint 2010? 3/1/2013 9:27 AM Tom
If you update / modify any localization string, or, add new language, we should build and deploy. It is time consuming. Any better solution like, use a cutom list to store and retrive localization strings, instead of different resource files.?

# re: How to Create Multilingual Webpart in SharePoint 2010? 3/1/2013 9:46 AM Venkatx5
Hi Tom,
You can deploy(paste) the new language files on respective 14 root folder for new language. You can also use custom list like Language Store and keep all the values for different language. But you need to write custom code/method to get the Multilingual value from the list. But am doubt the performance will be low when compare with Resource file. Because IIS/.Net Framework caches the resource files and serve the requests Whereas if u go for list then it'll take more time.

# re: How to Create Multilingual Webpart in SharePoint 2010? 3/1/2013 4:50 PM kelalung
i have a question about coding Quick Launch Localization in sharepoint 2010

i override FeatureActivated in feature of SP 2010, and add heading left menu.
but when deloy, the text display of default language show "$Resources:resources,key1" but i switch other language, this text display is correct.
why ?? can who help me?

# re: How to Create Multilingual Webpart in SharePoint 2013 6/9/2014 9:19 PM Bekki
For those of you trying to do this in SharePoint 2013 here's an article that will help:
http://www.ravn.co.uk/2013/04/25/how-to-make-your-web-parts-multilingual-in-sharepoint-2013/

comments powered by Disqus