| Context and Deployment Descriptor > The Application Context > About Internationalization |
About Internationalization |
INDEX
PREVIOUS
NEXT
|
The context can also store locale information for internationalization. The locale can be defined through the deployment descriptor or through the API.
The following example illustrates how you can customize the context locale in the deployment descriptor file:
<locale>
<language>fr</language>
<country>FR</country>
</locale>
where:
See java.util.Locale for more information on locale arguments.
The following code shows how to create a context with the French locale:
IlpContext context = new IltDefaultContext(Locale.FRENCH);
By default, JViews TGO is localized for the en_US locale. To create a localized version for another language, do the following:
jviews-tgo-all.jar:
ilog/cpl/messages/EquipmentMessages.properties
ilog/tgo/messages/JTGOMessages.properties
ilog/cpl/messages/NetworkMessages.properties
ilog/cpl/messages/TableMessages.properties
java.util.PropertyResourceBundle.
The following code extract shows how you can access the JViews TGO resource bundle and retrieve its messages according to the locale that is currently set in your application context:
Locale locale = context.getLocale();
ResourceBundle bundle =
IlpI18NUtil.GetResourceBundle("ilog.tgo.messages.JTGOMessages", locale,
"ILOG JTGO");
String value = bundle.getString("ilog.tgo.Alarm_Critical");
You can also retrieve localized resources from a CSS configuration file.
To do so, use the CSS function 'resource' (ilog.cpl.css.function.IlpResourceFunction) as illustrated below:
object."ilog.tgo.model.IltAlarm/perceivedSeverity"[perceivedSeverity=Critical] {
label : '@|resource("ilog.tgo.messages.JTGOMessages", "ilog.tgo.Alarm_Critical", "Critical")';
}
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |