Creating multilingual Site Definitions with Visual Studio 2010 SharePoint Development Tools
Best Practices, Deployment, Development, SharePoint 2010, Visual Studio 2010When working on SharePoint Solutions one of the common requirements is delivering multilingual solutions. Depending on your scenario you might either need to localize a single Web Part or a complete Solution. Thinking of multiple languages you have to take into account not only the development but also the packaging process for all the different assets in your Solution. One of such assets, where implementing support for multiple languages in SharePoint 2010 might seem complex at first sight, are Site Definitions. However you can easily create a multilingual Site Definition using nothing more than the standard capabilities of the new Visual Studio 2010 SharePoint Developer Tools.
If you look at the new Visual Studio 2010 SharePoint Developer Tools, it seems like they have no support for localizing custom Site Definitions at first. If you create a custom Site Definition using the standard toolset, you get a Site Definition that is bound to a specific language by the Deployment Location of the WebTemp*.xml file.
As you might know, localized Site Definitions share all the resources except for the WebTemp*.xml file. The WebTemp*.xml file contains the localized names of the specific Configurations and points to the shared onet.xml file. While the name of the WebTemp*.xml file doesn’t matter that much (as long as it matches the WebTemp*.xml pattern) it is a good practice to append the the identifier of your custom Site Collection to the WebTemp prefix to make it easier to track all Site Definitions installed in the Farm.
If you look at the custom Site Definition that gets created by the Visual Studio 2010 SharePoint Developer Tools you might see one challenge with delivering a multilingual Site Definition. As you can see all files (default.aspx, onet.xml and WebTemp*.xml) are in the same directory. In order to deliver the translated version of your Site Definition in another language you would have to create a copy of the WebTemp*.xml file, but you cannot have two files with the same name in the same directory, can you? So what are the options?
A few approaches that are not quite what you really want…
First of all you could create a new Site Definition project for every translation of your Site Definition. By sharing the common files like pages and onet.xml you could get the job done, but it would make the packaging process unnecessarily complex. First of all you would have a few projects with only a couple of files, and additionally you would end up hacking the identifiers to get it all right.
Another thing that you might try is to choose a different name for every WebTemp*.xml file, for example one that includes the locale like: WebTempMySiteDef1033.xml. This would definitely work and it would allow you to get it all done within a single project. It would be quite quirky though with all the different names and definitely not intuitive for someone not involved with the project during the development stage as it doesn’t follow the good practices. But there is however one more approach worth trying…
Creating multilingual Site Definitions the proper way
One more thing that you could do is to create a directory named after the locale for every language that your Site Definition should support. That would allow you to use the same names for the WebTemp*.xml files and would prevent you from using hacks and dodgy workarounds.
The first step in this approach is to create a regular Site Definition using the Site Definition SharePoint Project Template.
Then you would create a directory named after locale for every locale that your Site Definition must support:
The next step is to move the original WebTemp*.xml file to one of the locale directories and copy it to all the other locale directories translating the contents to match the locale:
The final piece of the puzzle is to change the Deployment Location of each of the WebTemp*.xml files so that they are deployed to the location specified by the locale folder. You can do that using the Properties Window of every WebTemp*.xml file:
And that’s it. Using this simple solution you can develop and package a multilingual Site Definition using the standard capabilities of the Visual Studio 2010 SharePoint Developer Tools and not a single hack!

















June 14th, 2010 at 6:45 pm
[...] Dit blogartikel was vermeld op Twitter door Waldek Mastykarz, Planet SharePoint. Planet SharePoint heeft gezegd: Waldek Mastykarz: Creating multilingual Site Definitions with Visual Studio 2010 #SharePoint Development http://planetsharepoint.org/1bd8c6 [...]
July 1st, 2010 at 12:39 pm
Good post!
How about the onet.xml? Wouldn't I need to place that in the LCID sub folders as well? For example, I specify language specific titles for pages in the onet.
July 2nd, 2010 at 6:28 am
@Jonas: while you could of course do that, I think that it would be a better idea to use Resource files for that, so that you have one globalized copy of onet.xml and a Resource file for every language that your Site Definition supports.
April 5th, 2011 at 12:16 pm
Hi Waldek,
A knowledge filled post indeed. I have a problem, I want to create multilingual sites but seem to hit a roadblock when trying to achieve this using sharepoint 2010's VARIATIONS and Content DEPLOYMENT features. Can you provide me an approach?
My requirement is that, the content should be editable from the target sites as well and all the metadata should be in the respective language as well.
April 5th, 2011 at 1:35 pm
@Dhawal: First of all when using Content Deployment you cannot edit content on the target site. That's just how things work in SharePoint. As for the metadata: what is your challenge exactly?
April 19th, 2011 at 4:33 pm
Hey Waldek,
I've got a case in which the customer wants sites in two different languages. I create the sites programmatically based upon a custom site defintion. Suppose I want a different default page for Dutch and one for German; what would be a good approach to acheive this? And how do you go about for webparts? Is that all managed in resources files?
April 20th, 2011 at 3:33 pm
@Jasper: if you have two separate sites for which you want different default pages, what you could do is to configure the Welcome Page of each site to your desirable page. Although I haven't tested that I would assume that the default variation redirect doesn't redirect to a specific page but rather to a site which should pick up your alternative page. As for Web Parts it depends on your implementation: you can use Resource files but if you want the content editors to be able to manage the labels a solution such as the Language Store might be a better choice.
June 4th, 2011 at 5:36 am
Good post!
I have similar requirement where client wants site in 2 languages.
I can either create seperate sites for English and French, with different contents
Or same site, but some how, update the site/Pages content to display English or French when language is changed?
What could be the solutions for this???
Also if i go with the two-sites solution, is their a good practice of the "URL" naming convention?
e.g.
http://www.domain.com/sites/en/
http://www.domain.com/sites/fr/
or
http://www.domain.com/sites/_EN
http://www.domain.com/sites/_FR
etc?
June 4th, 2011 at 7:39 am
@Usman: Have you considered using Variations?
July 21st, 2011 at 4:36 pm
Hi Waldek,
I have a requirement like, I want to create a custom web template from basis team site with additional custom lists, document libraries of SharePoint 2010. This web template is supposed to used by users in different lanuages like English, Japanes, French, German, Spanish. Is there anyway I can create a web template that supports all the above languages and when user selects a language in "Create Site" page, the created site will be in that particular language with all list/document library titles also shown in the respective language.
Note: I want to achieve this by using the Web Templates as they can be stored in the Solution gallery and can be made changes as and when required. If I go with Site Definations, the hosting environment may not allow me to copy the site defination files to web front end server.
Thanks
July 25th, 2011 at 3:04 pm
@Krishna: Have you tried using the Locale attribute in the WebTemplate element as shown in the SDK (http://msdn.microsoft.com/en-us/library/ff408392.aspx)?
July 31st, 2011 at 11:51 pm
thank you very much for the post. It really saved a lot of time. I really appreciate.
August 12th, 2011 at 7:46 am
Hi Waldek,
Thanks for sharing the post. I wanted to know what would be the better approach for creating multilingual site(in
Ex: Chinese, Portuguese, Japaneses etc) with a given generic site template developed in English. Each of these multilingual site which will have different content. At first Is this possible? I am not sure if content deployment of source and destination would help in such scenario.
August 12th, 2011 at 8:14 am
@Raghavendra: Have you considered using Variations?
October 19th, 2011 at 7:40 pm
[...] http://blog.mastykarz.nl/creating-multilingual-site-definitions-visual-studio-2010-sharepoint-develo... [...]
December 12th, 2011 at 3:30 am
[...] Creating multilingual Site Definitions with Visual Studio 2010 SharePoint Development tools http://blog.mastykarz.nl/creating-multilingual-site-definitions-visual-studio-2010-sharepoint-develo... Share this:TwitterFacebookLike this:LikeBe the first to like this [...]