O'Reilly logo

ASP.NET 2.0 Website Programming Problem - Design - Solution by Marco Bellinaso

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.3. Solution

As a sample implementation for this chapter, I fully localized the command layout stored in the template.master file, and most of the user controls, especially those that are part of the site's common structure, such as NewsletterBox, PollBox, ShoppingCartBox, ThemeSelector, WelcomeBox, and PersonalizationManager. To do this, you start by editing the template.master file and wrapping the static text you want to localize (such as the copyright notices, or the acknowledgments to Template Monster for providing the sample layout) into Localize controls. Then, from the Design View, you execute the Generate Local Resource command for the master page, thus creating a Template.master.resx file under the root App_LocalResources special folder. You copy this file into the same folder, rename it to Template.master.it-IT.resx (for Italian), open it in Visual Studio's resource editor, and translate all string values to the destination language. Figure 11-10 is a screenshot of the resource file for Italian opened in the editor.

Figure 11.10. Figure 11-10

Then you follow the exact same process for the controls mentioned above, which will produce a number of resource files under /Controls/App_LocalResources, as shown in Figure 11-11.

Figure 11.11. Figure 11-11

Yet another thing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required