Partilhar via


How to: Create Localized Versions of Custom Site Definitions

This topic explains how to create localized versions of your custom site definitions and configurations.

Applies to: SharePoint Foundation 2010

Site definition configurations are not localized by means of .resx files. Instead, a separate webtemp*.xml file is created for each language.

Note

The procedure in this topic assumes that you have created a custom site definition as explained in How to: Create a Custom Site Definition and Configuration. This will be referred to as "the earlier topic" throughout this topic. You reuse the same Microsoft Visual Studio project from the earlier topic for the procedure in this topic.

To create localized versions of custom site definitions and configurations

  1. Complete the actions specified in Preparing to Create Localized SharePoint Solutions.

  2. Reopen the Visual Studio project that you created for the earlier topic.

  3. Right-click the project name in Solution Explorer (not the Site Definition node), point to Add, and then select SharePoint Mapped Folder.

  4. In the Add SharePoint Mapped Folder dialog box, navigate to TEMPLATE\LCID\XML, where LCID is the numeric identifier of the first language for which you want to provide a localized version of the site definition, and then click OK. An XML folder is created in your project.

  5. Right-click the XML folder, point to Add, and then select New Item.

  6. Click Visual C# or Visual Basic in the Installed Templates panel, and then select XML file.

  7. Give the file the same name as you gave the custom webtemp*.xml file in the earlier topic, except that you should add the LCID to the file name just before the "."; for example, WebTemp_RESEARCH_3082.xml.

  8. Click Add. Adding the file to the mapped folder in this manner automatically configures the package manifest to deploy the file to %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LCID\XML, where LCID is the numeric identifier of the language.

  9. Replace the contents of the new webtemp*_LCID.xml file with the contents of the original custom webtemp*.xml file that you created earlier.

  10. Replace the values of the Title, Description, and DisplayCategory attributes in all the Configuration elements with translated versions of the same values. If the localized version uses a different image from the original, edit the value of the ImageUrl attribute to point to the alternative image. (If the image is not already deployed, you can deploy it in the project by adding a SharePoint "Image" Mapped Folder—which is mapped to the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\Images folder. Then add the image to that folder in the project.) Do not change the other attribute values in the file, such as ID.

  11. Repeat the preceding steps for every language for which you want to provide a localized version of the site definition. Each time a new "XML" folder is created in the project, Visual Studio adds a number to the end of the folder name (XML 1, XML 2 ...). The numbers are for the convenience of you, the developer. The package manifest is automatically configured to deploy each file to the appropriate %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LCID\XML folder.

An alternate technique is to add each webtemp*_LCID.xml file to the same folder in the project as the original webtemp*.xml file. However, by default Visual Studio configures the package manifest to deploy all of these files to the same %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LCID\XML folder where LCID is the original language. This is not what you want. Accordingly, you will have to right-click each of the webtemp*_LCID.xml files in turn and select Properties. Expand the DeploymentLocation section and replace the LCID part of the Path property with the same LCID that is used in the file name.

Note

The onet.xml file is not localized.

See Also

Tasks

How to: Create a Custom Site Definition and Configuration

Concepts

Preparing to Create Localized SharePoint Solutions