Configuration Issues > Globalization > Implementation
 
Implementation
Uniqueness of the IlEnvironment instance
By default, the only constructor of the class is protected. Applications cannot directly create instances of that class. Applications must use the static function IlEnvironment::Get to gain access to an instance.
It is guaranteed there will be at most a unique instance of that class while the application is running. Applications can delete the instance. The next call to IlEnvironment::Get will create a new one.
The IlEnvironment class
The IlEnvironment class operates as follows:
*accesses the instance status, if errors or warnings are raised;
*accesses or modifies the date and time, and number formatters;
*handles external resources, using either ICU or application-specific format;
*handles runtime options.
Call-backs
Applications can set call-backs with some data to be passed to them when called.
1. Change Locale Call-back
The call-back must be used whenever the locale is changed. This allows the application to be notified of the change and proceed to whatever adjustments it may need to make. For example, when using a graphical user interface, the application may need to refresh all its windows to display messages, titles, and many textual contents using the new language.
The call-back is set using the function setChangeLocaleCallback. The first argument of this function is of type IlChangeLocaleFunc; its second, optional, argument is application-specific and, as such, as no specific type (IlAny).
Note that all the pre-existing formatters are destroyed when the locale is changed. It is recommended that the application does not keep references to the formatters when it makes a direct use of them.
2. Get Resource Call-back
Another call-back can be set to be used whenever the getResource function is called. This call-back is set using the function setGetResourceCallback. The first argument of this function is of type IlGetResFunc; its second, optional, argument, of type IlAny, is any data the application may need to have passed to the call-back when it is called.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.