|
Applicet Framework for Applets and Applications v2.03 | ||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--be.arci.applet.I18NDelegate
Groups all internationalization (I18N) support for the Applicet Framework, allowing to leave this out of the distribution package for basic applets. The Applicet I18N methods delegate to this class, of which a single instance is associated with the Applicet as soon as needed.
Use setLocale() to change the default locale of the Applicet. Use setI18NDefault() to change the I18N set of .properties files to use with getI18NString(), formatI18NString() etc. Use getI18NSet() to retrieve and read an I18N set of .properties files for yourself.
Note: We could have let you use ResourceBundle.getBundle() instead, but older versions of ResourceBundle, as used in many browsers, step on their own foot when trying to retrieve a .properties file with the same basename as a .class file. Also our I18N methods are more forgiving on missing resources. You might still want to use ResourceBundle for retrieving non-textual localized resources.
Applicet.getI18NDelegate,
JApplicet.getI18NDelegate,
"Internationalization support",
"java.awt.Component.setLocale()"| Method Summary | |
java.lang.String |
formatI18NString(java.util.Properties prpI18NSet,
java.lang.String sPatternName,
java.lang.String sDefaultPattern,
java.lang.Object[] aoArgs)
Formats an array of Object arguments to a localized message according to the named pattern; the pattern name is used to look up both the localized pattern as well as localized argument Strings for those Object arguments that are null. |
java.util.Properties |
getI18NDefault()
Returns the default I18N set of .properties files that is used by getI18NString(), formatI18NString() etc. |
java.lang.String[][] |
getI18NParameterInfo(java.util.Properties prpI18N,
java.lang.String[][] aasDefault,
char cDelimiter)
Retrieves localized parameterinfo based on a default array of parameterinfo Strings. |
java.util.Properties |
getI18NSet()
Loads and returns an I18N set of .properties files for the default locale, using the qualified Applicet subclass name as base name; if not found, an empty Properties object is returned. |
java.util.Properties |
getI18NSet(java.lang.Class clsBase)
Loads and returns an I18N set of .properties files for the default locale, using the qualified name of the supplied class as base name; if not found, an empty Properties object is returned. |
java.util.Properties |
getI18NSet(java.lang.Class clsBase,
java.util.Locale locTopLevel)
Loads and returns an I18N set of .properties files for a specific locale, using the qualified name of the supplied class as base name; if not found, an empty Properties object is returned. |
java.util.Properties |
getI18NSet(java.util.Locale locTopLevel)
Loads and returns an I18N set of .properties files for a specific locale, using the qualified name of the Applicet subclass as base name; if not found, an empty Properties object is returned. |
java.util.Properties |
getI18NSet(java.lang.String sBaseName)
Loads and returns an I18N set of .properties files for the default locale, using the supplied qualified base name; if not found, an empty Properties object is returned. |
java.util.Properties |
getI18NSet(java.lang.String sBaseName,
java.util.Locale locTopLevel)
Loads and returns an I18N set of .properties files for a specific locale and qualified base name; if not found, an empty Properties object is returned. |
java.lang.String |
getI18NString(java.util.Properties prpI18NSet,
java.lang.String sName,
java.lang.String sDefault)
Searches for the localized String with the specified name in the specified I18N set of .properties files. |
java.lang.String[] |
getI18NStringArray(java.util.Properties prpI18NSet,
java.lang.String sName,
java.lang.String sDefault,
char cDelimiter)
Searches for the localized String with the specified name in the specified I18N set of .properties files for this Applicet, and splits it into an array of Strings using the delimiter character. |
void |
setI18NDefault(java.util.Properties prpI18NDefault)
Sets the default I18N set of .properties files for use in subsequent calls to getI18NString(), formatI18NString() etc. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public java.lang.String getI18NString(java.util.Properties prpI18NSet,
java.lang.String sName,
java.lang.String sDefault)
prpI18NSet - the I18N set of .properties files
in which to look up localized Strings.sName - the property name.sDefault - the default value for the localized String.Applicet.getI18NString,
JApplicet.getI18NString,
setI18NDefault
public java.lang.String[] getI18NStringArray(java.util.Properties prpI18NSet,
java.lang.String sName,
java.lang.String sDefault,
char cDelimiter)
prpI18NSet - the I18N set of .properties files
in which to look up localized Strings.sName - the property name.sDefault - the default value for the localized String.cDelimiter - character delimiting the String array
elements in the localized String entry in the .properties files.Applicet.getStringArray,
JApplicet.getStringArray,
setI18NDefault,
Applicet.getStringArray,
JApplicet.getStringArray
public java.lang.String formatI18NString(java.util.Properties prpI18NSet,
java.lang.String sPatternName,
java.lang.String sDefaultPattern,
java.lang.Object[] aoArgs)
Localized Strings are retrieved from the specified I18N set of .properties files
Formatting is done through java.text.MessageFormat, using the current locale of the Applicet (getLocale()). If an Object argument is not null, it is used as such (these Object arguments can be Strings too). If an Object argument is null, it is replaced with the localized String named "patternname.i", where i is the number (0-9) of the argument; if such localized String cannot be found, its name is used as default value.
If no formatting can be done (named pattern not found and no default pattern given), a return value is composed of the pattern name and the String representation of the Object arguments that are not null.
prpI18NSet - the I18N set of .properties files
in which to look up localized Strings.sPatternName - the property name of the pattern.sDefaultPattern - the default pattern to use if the named
pattern is not found.aoArgs - array of Objects to format into the localized pattern
String; a null Object aoArgs[i] is replaced by a localized String
from the I18N set that has the property name
(sPatternName + "." + i)Applicet.formatI18NString,
JApplicet.formatI18NString,
setI18NDefault
public java.lang.String[][] getI18NParameterInfo(java.util.Properties prpI18N,
java.lang.String[][] aasDefault,
char cDelimiter)
An example of an appropriate parameter info definition can be found in be/arci/applet/Applicet.properties.
prpI18NSet - the I18N set of .properties files
in which to look up localized Strings.
aasParameterInfo - array of parameter info Strings that acts as default. Each
element of the array should be a String array with as first element the parameter
name. Subsequent elements can supply default Strings for the type and description
of the parameter. Default type and description String elements that are not
present in the array or are null, will be replaced by an empty String if no
localized String is found for them.
cDelimiter - separator between type and description Strings in the
.properties files; one separated the respective Strings are trimmed.Applicet.getI18NParameterInfo,
JApplicet.getI18NParameterInfopublic java.util.Properties getI18NDefault()
IMPORTANT:
We are sure you know this already, but just that you don't forget:
use the getProperty() method of java.util.Properties on the return
value, not the get() method of its superclass java.util.Hashtable.
The get() wouldn't let you go down the hierarchical default of the I18N set.
Applicet.getI18NString,
JApplicet.getI18NString,
setI18NDefault,
getI18NSetpublic void setI18NDefault(java.util.Properties prpI18NDefault)
Applicet.getI18NString,
JApplicet.getI18NString,
getI18NDefault,
getI18NSetpublic java.util.Properties getI18NSet()
getI18NSet(String sBaseName, Locale locTopLevel),
setI18NDefault,
getI18NDefaultpublic java.util.Properties getI18NSet(java.lang.Class clsBase)
getI18NSet(Class clsBase, Locale locTopLevel),
setI18NDefault,
getI18NDefaultpublic java.util.Properties getI18NSet(java.lang.String sBaseName)
getI18NSet(String sBaseName, Locale locTopLevel),
setI18NDefault,
getI18NDefaultpublic java.util.Properties getI18NSet(java.util.Locale locTopLevel)
getI18NSet(String sBaseName, Locale locTopLevel),
setI18NDefault,
getI18NDefault
public java.util.Properties getI18NSet(java.lang.Class clsBase,
java.util.Locale locTopLevel)
baseClass - class that the requested .properties file is
associated with; the qualified name of the class (without extension) serves
as basename.locTopLevel - highest locale in the I18N set hierarchygetI18NSet(String sBaseName, Locale locTopLevel),
setI18NDefault,
getI18NDefault
public java.util.Properties getI18NSet(java.lang.String sBaseName,
java.util.Locale locTopLevel)
getI18NSet(),
getI18NSet(Locale),
getI18NSet(String),
setI18NDefault,
getI18NDefault
|
Applicet Framework for Applets and Applications v2.03 | ||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||