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().
- 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.