SharePoint supports content localization to enable the site members to have a SharePoint site in their very own languages. This is very innovative feature of SharePoint with which one can create multilingual sites very easily.
When it comes to creating a multilingual site, particularly, a developer concentrates on the parts on which localization is to be applied. As we know for any SharePoint site, we have a page, where we have, page content, few webparts, header and footer.
With advent of Machine Translation Service in SharePoint 2013, one can easily have a translation of page content by using Microsoft Translator Service. As far as other parts of the page are concerned, web part, particularly, can have some difficulties translating each and every content.
For the same, we can use a resource file, which will enable the webpart interface to adopt to specific language. In this particular post, I will be describing a step by step method to get some content localized by using resource file.
Instructions to create the webpart
Create an empty Visual Studio Project.
Provide a website to debug the solution and select “Deploy as farm solution”.
Let us add a visual webpart in the solution, named SampleWebPart using New Item option in Add menu.
I have added two labels with the id as shown below.
It is time to add our resource files. For the same, we’ll map a resource folder
I will right click on the solution and select Add, where I will find SharePoint Mapped Folder.
After selecting resources in the proceeding screen, I will be able to see a resources folder in my solution.
In the Resources folder, I will create the resource file, by clicking Add Item.
Note the file name for the resource file: Resource.en-US.resx
Add some content to the resource file.
In the same way, create another resource file for the other language required.
Now we’ll do some programming to get our localization working.
We are ready to go!
Just build and deploy the solution!
The preview on English Site
The Preview on Hindi Site: