ASP.NET


Visual Studio 2005 is a quantum leap beyond Visual Studio 2003 in terms of internationalization of ASP.NET applications. As with so many features in the .NET Framework 2.0 and Visual Studio 2005, this subject alone justifies the upgrade.

Localizability

Visual Studio 2005 enables you to localize forms with the same kind of productivity and efficiency that Visual Studio provides for Windows Forms applications. Select Tools, Generate Local Resources from Visual Studio 2005's menu; all the Localizable property values are moved to an associated resx file, and a "meta:resourcekey" attribute referring to those resources is added to the control. See the "Localizability in Visual Studio 2005" section in Chapter 5, "ASP.NET Specifics."

Web.config <globalization> culture and uiCulture Attributes

The <globalization> section of Web.config has always had culture and uiCulture attributes, which enable you to specify the CurrentCulture and CurrentUICulture of an entire Web site or folder. In ASP.NET 2.0, however, these attributes can be set to "auto" to automatically pick up the user's preferred settings from the HTTP header. See the "Application-Wide Automatic Culture Recognition" section in Chapter 5.

New Page Culture and UICulture Attributes

The Page class now supports Culture and UICulture attributes, which work in the same way as the <globalization> element's culture and uiCulture attributes, except that they apply to a single page. See the "Automatic Culture Recognition for Individual Pages" section in Chapter 5.

New Page.InitializeCulture Method

The Page class has a new method called InitializeCulture, which can be overridden to set the culture. This method is called before all the page's events so that it occurs early in the pipeline. You would use this method if the "auto" settings did not provide the functionality you are looking for. See the "Manual Culture Recognition for Individual Pages" section in Chapter 5.

Web Control Properties Are Marked as Localizable

In ASP.NET 1.1, no properties of any control are marked with the Localizable attribute. This is because Visual Studio 2003 does not offer any localization support for ASP.NET applications, so the presence or absence of the Localizable(true) attribute makes no difference. In ASP.NET 2.0, you will find that many properties of Web controls are marked as Localizable(true), and this is how Visual Studio 2005 can localize pages. What is important to note here is that only a few HTML control properties are marked as Localizable(true). In general, this means that if you want to localize your ASP.NET applications, you must use Web controls instead of HTML controls.

New Localize Control

The Localize control inherits from the Literal control and adds no new properties, methods, or events. At runtime, the Localize control is identical to the Literal control. The difference between the two controls lies in Visual Studio 2005's handling of these controls at design time. The Localize control uses the Localize Designer, whereas the Literal control uses the LiteralDesigner. The purpose of both the Localize control and the Literal control is to allow text to be placed in a control that can be localizedyour choice between the two controls is determined by your preference of design-time support.

Automatic resx File Change Detection

By default, ASP.NET 2 applications monitor their associated resx files at runtime. When one of their associated resx files changes, ASP.NET unloads the application domain, rebuilds the associated resource assemblies, and reloads the application. This means that translators can modify resx files and see their changes immediately. In addition, the resources used in Web sites can be updated without needing to manually rebuild the application. Of course, this unloads the application domain, and any state in that domain will be lost. See the "ASP.NET 2.0 Translation/Localization Strategies" section in Chapter 14, "The Translator."




.NET Internationalization(c) The Developer's Guide to Building Global Windows and Web Applications
.NET Internationalization: The Developers Guide to Building Global Windows and Web Applications
ISBN: 0321341384
EAN: 2147483647
Year: 2006
Pages: 213

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net