How to Localize a Feature in SharePoint 2010 Using Visual Studio 2010

Introduction

In this article you will be seeing how to localize a feature in SharePoint 2010 using Visual Studio 2010. Instead of using the hard-code values for feature title and description, we can use expressions that represent localized resources.

Steps Involved

  1. Open Visual Studio as administrator.
  2. Go to File, select New and then click on Project.

    LclShr1.jpg
     
  3. Select Empty SharePoint Project from the installed templates.

    LclShr2.jpg
     
  4. Enter the Name as LocalizeFeature and then click on Ok.
  5. Enter the site URL and select "Deploy as farm solution".
  6. Click on Finish.

    LclShr3.jpg
     
  7. Right-click on the Features folder and then click on Add Feature.

    LclShr4.jpg
     
  8. Rename the feature as LocalizeFeature.
  9. Right-click on the LocalizeFeature and then click on Add Feature Resource.

    LclShr5.jpg
     
  10. In the Add Resource pop up, select the culture of the resource file.

    LclShr6.jpg
     
  11. I have selected English (United States), and then click on Ok.
  12. In the Resource Editor, enter the String Name and Value as shown in Figure.

    LclShr7.jpg
     
  13. Similarly I have added a feature resource for the French (France) language and the string names and values are added as shown in the following figure:

    LclShr8.jpg
     
  14. Double-click on LocalizeFeature.feature and change the title & description as shown in the following figure:

    LclShr9.jpg
     
  15. Right-click the solution and then click on Deploy Solution.

Testing

  1. Navigate to the site, click on Site Actions.
  2. Click on Site Settings.
  3. Click on Manage Site Features under Site Actions.
  4. You will see the feature title and description in English (the default language is English) as shown in the following figure:

    LclShr10.jpg
     
  5. Change the language to French and you will be able to see the localized feature title and description as shown in the following figure:

    LclShr11.jpg

    LclShr12.jpg

Note: Make sure the language packs are installed in the SharePoint server.

Summary:

Thus in this article you have seen how to localize a feature in SharePoint 2010 using Visual Studio 2010.