Do more with your ASP.NET Page Template
page 5 of 9
by Sajid Rehman
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 31901/ 43

How do I do it? Internationalization

Internationalization features can be provided in your Page Template by –

  • In the OnLoad() method –
    • Check if the ResourceManager is in the Application object.
    • If not, create a new ResourceManager object pointing to your resource file & store it in the Application object.
    • Set the ResourceManager object in a private variable.
    • Also, set the CurrentCulture & CurrentUICulture objects based on the language variable in the session.
  • Provide a protected method in your Page Template (say GetResource()) that returns the appropriate text (from the resource file) for the key passed to it. This method uses the private ResourceManager object set in OnLoad().

Advantages

  • Developers do not have to repeatedly check the user’s language preference & then set the Culture objects. This is done by the OnLoad() method of the template.
  • A single method is used to get data from resource files.
  • The resource files are set in the Page Template class itself & not by the individual developer. This avoids any issues that may arise due to incorrect resource file names across pages & developers.

View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-28 7:49:18 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search