17.2.Â Providing Multiple Language Support
You want to support multiple languages in your application without developing multiple versions of each page.
Use resource files to provide the text for each user interface element in the languages you wish to support, add attributes to the static controls in your .aspx files to set their text automatically from the resource files at runtime, set the
uiCulture attributes of the
<globalization> element in web.config to
auto, and set the values for dynamic controls in the code-behind class.
Use Visual Studio 2005 to create the root resource file and add the resource attributes to the controls in your .aspx files as follows:
Open the .aspx file that you want to localize.
Select Tools â Generate Local Resource from the menu. Visual Studio 2005 will add a
meta:resourcekeyattribute to all server controls in the file and create a root resource file with entries for each of the server controls.
Duplicate the root resource file for each language and culture to be supported by your application, setting the values to the resource items as appropriate for the language.
uiCultureattributes of the
<globalization>element in web.config to
<globalization culture="auto" uiCulture="auto" />
In the code-behind class for each page that needs to support multiple languages, use the .NET language of your choice to:
Set the values of controls used for date and currency.
Set the text of any controls ...