How to: Localize Templates

It is possible to create multiple versions of a template in multiple languages. Use the procedures in this topic to create and save your templates for use with multiple localized versions of Visual Studio. This topic divides localization into two categories: user templates and product templates.

User Templates

User templates are located in the locations specified in the General, Projects and Solutions, Options Dialog Box, and appear in the New Project dialog box under the heading My Templates.

There is no way to automatically localize user templates. The easiest way to create a template in more than one language is to create multiple template .zip files, and name them accordingly. These template .zip files can exist side-by-side in the user template directory, and a user can select a localized template from the New Project dialog box.

To localize user templates

  1. Create a version of a template for each localized language, specifying the locale in the Name element of the template.

  2. Save each template as a uniquely named .zip file.

  3. Copy each template to the location specified in the Options dialog box for projects and solutions. For more information, see General, Projects and Solutions, Options Dialog Box.

    All versions of the template will appear in the New Project dialog box.

Product Templates

Product templates are located in a folder in the Visual Studio installation directory, and appear in the New Project dialog box under the heading Visual Studio installed templates.

The directory for product templates includes a locale identifier (LCID), which indicates the folder for Visual Studio to use for templates. Each programming language also has its own subfolder for templates in that language. For example, an instance of Visual Studio with an LCID of 1033 would use the folder Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\<ProgrammingLanguage>\<TemplateCategory>\1033 for project templates. <ProgrammingLanguage> is the language for which the templates are created, such as CSharp, JSharp, or VisualBasic. <TemplateCategory> is the subcategory under the programming language, such as Windows, Database, and SmartDevice. For a list of the languages and LCIDs supported by Visual Studio, see /LCID (devenv.exe).

Each localized version of a template must be located in the correct LCID folder, so that Visual Studio can display the template in the New Project dialog box.

To localize product templates

  1. Create a version of a template for each localized language.

  2. Save each template in the correct LCID folder in the product template directory. By default, this location is Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\<ProgrammingLanguage>\<TemplateCategory>\<LCID>.

    Only versions of the template in the folder with an LCID matching the current instance of Visual Studio will appear in the New Project dialog box.

The Name, Description, and Icon elements all contain Package and ID attributes that can be used to create multiple localized projects from a single project template. You must use the Visual Studio automation object model to take advantage of these elements. This is only beneficial in specific circumstances, for example, using a template to create a project in a language other than the current language. Generally, you should follow the steps listed in the preceding procedures to create localized templates.

See Also

Concepts

How to: Locate and Organize Project and Item Templates

Reference

Name Element (Visual Studio Templates)

Description Element (Visual Studio Templates)

Icon Element (Visual Studio Templates)

Other Resources

Advanced Template Procedures

Starter Kits

Visual Studio Templates