BEA WebLogic Server Manual page 82

Internationalization guide
Hide thumbs Also See for BEA WebLogic Server:
Table of Contents

Advertisement

D
TextFormatter Class Reference for BEA WebLogic Server
In this
The Localizer
catalog, the
to the
argument to
catalog information.
}
}
Listing 4-5
catalog.
D-6
Internationalization Guide
*/
HelloWorldTextFormatter fmt = new HelloWorldTextFormatter(lcl);
fmt.setExtendedFormat(true);
/*
* print the text in the current locale
*/
System.out.println(fmt.helloWorld());
/*
* Alternatively, text can be accessed and formatted manually.
* case you must obtain the Localizer class for the catalog.
* class is
formed from the l10n_package attribute in the
* catalog name, and the string "TextLocalizer".
*/
Localizer l10n = L10nLookup.getLocalizer
(lcl,"examples.i18n.simple.HelloWorldTextLocalizer");
System.out.println(l10n.get("HELLO_AGAIN"));
/*
* If the message accepts arguments, then they can just be passed
* method defined for the message.
*/
System.out.println(fmt.nthHello(3));
/*
* If using the manual method then you must manually apply the
* the text using the MessageFormat class.
*/
String text = l10n.get("NTH_HELLO");
Object[] args = {new Integer(4)};
System.out.println(MessageFormat.format(text,args));
/*
* The Localizer class also provides methods for accessing
*/
System.out.println(fmt.version(l10n.getVersion()));
System.out.println(fmt.l10nPackage(l10n.getL10nPackage()));
System.out.println(fmt.i18nPackage(l10n.getI18nPackage()));
System.out.println(fmt.subSystem(l10n.getSubSystem()));
shows an example of the generated
for the HelloWorld
TextFormatter

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BEA WebLogic Server and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF