|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.ifs.common.Localizer
A Localizer encapsulates internationalization information.
Many methods in the iFS API require internationalization information, such as the appropriate locale, date format, time format, or number format. This data is encapsulated in a Localizer instance, which is made available to such methods.
Each LibrarySession has a Localizer based on arguments supplied to
LibraryService.connect
.
A Localizer also encapsulates the iFS resource bundle.
The getResourceString
methods of LibrarySession and
LibraryObject use this resource bundle to generate localized messages.
An application can override some or all of these messages, or introduce
its own messages, by invoking setExtendedResourceBundles
on the Localizer returned by LibrarySession.getLocalizer
.
Constructor Summary | |
Localizer()
Constructs a Localizer. |
|
Localizer(java.util.Locale locale)
Constructs a Localizer for the specified locale. |
|
Localizer(java.util.Locale locale,
LibrarySession session)
Constructs a Localizer for the specified locale. |
Method Summary | |
java.util.Calendar |
getCalendar()
Gets the Calendar of this Localizer. |
java.lang.String |
getCharEncoding()
Gets the Java naming character encoding of this Localizer. |
java.text.DateFormat |
getDateFormatter()
Gets the date formatter of this Localizer. |
static Localizer |
getDefault()
Gets the default US English Localizer. |
java.lang.String[] |
getExtendedResourceBundles()
Gets the extended resource bundles for this Localizer. |
java.lang.String |
getLanguage()
Returns the language for this LibrarySession in English. |
java.util.Locale |
getLocale()
Gets the locale of this Localizer. |
java.text.NumberFormat |
getNumberFormatter()
Gets the number formatter of this Localizer. |
java.lang.String |
getResourceString(java.lang.String key)
Gets the resource string for the specified key. |
java.lang.String |
getResourceString(java.lang.String key,
java.lang.Object[] params)
Gets the resource string for the specified key, and substitutes the specified parameters into that resource string. |
java.text.DateFormat |
getTimeFormatter()
Gets the time formatter of this Localizer. |
java.util.TimeZone |
getTimeZone()
Gets the time zone of this Localizer. |
void |
setCharEncoding(java.lang.String charEncoding)
Sets the character encoding of this Localizer. |
void |
setDateFormatter(java.text.DateFormat dateFormatter)
Sets the date formatter of this Localizer. |
void |
setExtendedResourceBundles(java.lang.String[] baseNames)
Sets the extended resource bundles for this Localizer. |
void |
setLanguage(java.lang.String language)
Sets the language to be used by context search. |
void |
setLocale(java.util.Locale locale)
Sets the locale of this Localizer. |
void |
setNumberFormatter(java.text.NumberFormat numberFormatter)
Sets the number formatter of this Localizer. |
void |
setTimeFormatter(java.text.DateFormat timeFormatter)
Sets the time formatter of this Localizer. |
void |
setTimeZone(java.util.TimeZone timeZone)
Sets the time zone of this Localizer. |
Constructor Detail |
public Localizer() throws IfsException
The Localizer's locale is the default locale of the Java VM. The Localizer has default number, date, and time formatters for that locale, and uses 8859_1 (ISO Latin1) character encoding.
IfsException
- (IFS-12000) if the operation failspublic Localizer(java.util.Locale locale) throws IfsException
The Localizer has default number, date, time formatters; and default Timezone and character encoding settings.
locale
- the locale of the Localizer. If null, the
default locale of the Java VM is used.IfsException
- (IFS-12000) if the operation failspublic Localizer(java.util.Locale locale, LibrarySession session) throws IfsException
The Localizer has default number, date, time formatters; and default Timezone and character encoding settings.
locale
- the locale of the Localizer. If null, the
default locale of the Java VM is used.session
- the LibrarySession to which the Localizer is
bound; any changes to this Localizer will
trigger identical changes in the Localizer of
the corresponding S_LibrarySessionIfsException
- (IFS-12000) if the operation failsMethod Detail |
public java.util.Locale getLocale() throws IfsException
IfsException
- if the operation failspublic void setLocale(java.util.Locale locale) throws IfsException
The number formatter, date formatter, and time formatter are set to default formatters for the specified locale.
locale
- the localeIfsException
- if the operation failspublic static Localizer getDefault()
This default is used by IfsException.getMessage
.
public void setCharEncoding(java.lang.String charEncoding) throws IfsException
charEncoding
- the Java-naming character encoding.IfsException
- if the operation failspublic java.lang.String getCharEncoding() throws IfsException
IfsException
- if the operation failspublic void setLanguage(java.lang.String language) throws IfsException
language
- the Oracle language name.public java.lang.String getLanguage() throws IfsException
public void setNumberFormatter(java.text.NumberFormat numberFormatter) throws IfsException
numberFormatter
- the number formatter. If null, a default
number formatter for the locale of this
Localizer is used.IfsException
- (IFS-12002) if the operation failspublic java.text.NumberFormat getNumberFormatter() throws IfsException
IfsException
- if the operation failspublic void setDateFormatter(java.text.DateFormat dateFormatter) throws IfsException
dateFormatter
- the date formatter. If null, a default
date formatter for the locale of this
Localizer is used.IfsException
- (IFS-12003) if the operation failspublic java.text.DateFormat getDateFormatter() throws IfsException
IfsException
- if the operation failspublic void setTimeFormatter(java.text.DateFormat timeFormatter) throws IfsException
timeFormatter
- the time formatter. If null, a default
time formatter for the locale of this
Localizer is used.IfsException
- (IFS-12004) if the operation failspublic java.text.DateFormat getTimeFormatter() throws IfsException
IfsException
- if the operation failspublic void setTimeZone(java.util.TimeZone timeZone) throws IfsException
timezone
- the time zone. If null, a default
time zone for the locale of this
Localizer is used.IfsException
- (IFS-12005) if the operation failspublic java.util.TimeZone getTimeZone() throws IfsException
IfsException
- if the operation failspublic java.util.Calendar getCalendar() throws IfsException
IfsException
- if the operation failspublic void setExtendedResourceBundles(java.lang.String[] baseNames) throws IfsException
baseNames
- an array of resource bundle names. Each
resource bundle name must be a valid argument to
ResourceBundle.getBundle(String)
.IfsException
- if the operation failspublic java.lang.String[] getExtendedResourceBundles() throws IfsException
ResourceBundle.getBundle(String)
.IfsException
- if the operation failspublic java.lang.String getResourceString(java.lang.String key) throws IfsException
The method looks-up the key in each extended resource bundle, in the
order specified by the array in setExtendedResourceBundles
,
until it finds a bundle containing the key. If no extended resource
bundle contains the key, the default resource bundle (LibraryResources)
is used.
key
- the resource bundle keyIfsException
- IFS-12001 if the operation failspublic java.lang.String getResourceString(java.lang.String key, java.lang.Object[] params) throws IfsException
The method looks-up the key using getResourceString(key)
.
Next, java.text.MessageFormat
is used to substitute the
parameters specified by params
into the key's value. If
a string element of params
is delimited by brackets, i.e.
"{param}
", then that element is replaced with the
value returned by getResourceString("param")
before
being passed to MessageFormat
.
key
- the resource bundle keyparams
- an array of Objects to be substituted into
the resource bundle message using using
java.text.MessageFormat
IfsException
- IFS-12006 if the operation fails
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |