How to: Create Resource Files for ASP.NET Web Sites

A resource file is an XML file that contains the strings that you want to translate into different languages. You create a separate resource file for each language that you want to translate a Web page into.

Global resource files are available to any page or component in the Web site. Local resource files are associated with a single Web page and contain the translated text for that page only. For more information, see ASP.NET Web Page Resources Overview.

You can include a full path, when specifying the names of the text and resource files.

When the command runs, it creates a .resx file that includes the correct XML definitions and elements.

Copy the resource file to the appropriate location in the Web site:

To use the resource file as a global resource, copy it to App_GlobalResources.

To use the resource file as a local resource, copy it to App_LocalResources.

Create additional resource files for each language or language and culture (CultureInfo name) that you want to support in your application. You can do either of the following:

Copy the first resource file to a new name that includes the language or language and culture information, and then translate the contents of the value elements to another language.

Repeat Steps 1 through 5 with the same key/value pairs, but with the values translated to another language. For the file name in step 5, include the language or language and culture names.

For example, the Spanish version of the SiteResources.resx file would be SiteResources.es.resx.

Note

When naming resource files, do not include .aspx in the name, because this can result in a naming conflict. For example, the Resource folder cannot contain two files with names such as resTestPage.resx and resTestPage.aspx.resx because the resolution of the file names at compile-time would create a naming conflict, resulting in a compile-time error.