How to: Localize Templates

You can create multiple language versions of a template. This topic shows how to localize both user templates and product templates.

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

For every language version of a template that you want to create, you must make a copy of the template, localize it, and then make a template .zip file. The template .zip files can exist side-by-side in the user template directory, and a user can select a localized template in the New Project dialog box.

To localize user templates

  1. Create a version of a template for every localized language, and specify the locale in the Name element of the template.

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

  3. Put the template .zip files in the location that is specified for projects and solutions in the Options dialog box. 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 are located in a folder in the Visual Studio installation directory. They are displayed 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. The templates are also sorted into subfolders that correspond to the programming language of the template. For example, the path of project templates in a version of Visual Studio that has an LCID of 1033 would be \Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\ProgrammingLanguage\TemplateCategory\1033\. ProgrammingLanguage is the language for which the templates are created, for ecample, C# or VisualBasic. TemplateCategory is the subcategory under the programming language, for example, Windows, Database, or SmartDevice. For a list of the languages and LCIDs that are supported by Visual Studio, see /LCID (devenv.exe).

Every 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 every 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 10.0\Common7\IDE\ProjectTemplates\ProgrammingLanguage\TemplateCategory\LCID\.

    Only the version of the template that has an LCID that matches the currently running version of Visual Studio will be displayed in the New Project dialog box.

Generally, we recommend that you follow the previous steps to create localized templates. However, the Name, Description, and Icon elements all contain Package and ID attributes that can be used to create multiple localized projects from one project template. You must use the Visual Studio automation object model to take advantage of these elements. This may be helpful in certain circumstances, for example, when you use a template to create a project in a language other than the current language.

Community Additions

ADD
Show: