Friday, August 9, 2013

Localize site columns, features and web parts

In this post we are going to see how we can localize site columns as well as features.
First let us focus on the site columns.

Create empty SharePoint project.



Now right click on project and click on add mapped folder and add resource folder.



Now again click on add new item by right clicking on resource folder and select resource file.



Add these two values



Now add one more resource file for Spanish language. add es-es to the file name as shown in the image below and add below entries.



Now it's time to create empty element where we would be adding the site columns.
Right click on project and add empty element.

Add this to the empty element.



Build and deploy the solution

One thing to consider here is that you need to have language packs installed on the server.
Go to the site settings and site columns. Right now we are with English language.



Change the language to Spanish



As you can see that column title gets converted to the Spanish language.

We already have a feature with us which has site columns element file. Our sole purpose is just to show how features can also be localized. Now right click the feature and click on add feature resource.



Select Spanish from long list of languages.

And add these texts



and then add this to the web part properties



When you have set the language to English, this is what you get



Switch language to Spanish.



Let us add one web part. After that open the same LocalizedSiteColumn.resx under resource folder and add this.



now open the Spanish resource file and add this



Now open the web part file and change the title and description to point it to resource file.

This will also localize the web parts. I hope this helps.

No comments:




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com