jsx3.app.Properties that supports localized properties. Using this class, an application
can define properties for a number of locales but only load the properties necessary to display a particular
locale. Additionally, this class supports fall-through so that if a property is not defined for a particular locale
that locale inherits the value from the next most specific locale.
A properties bundle can consist of one or more XML files. The main file, fileName.ext, contains the
properties for the default locale, as well as the properties for any number of other locales, and metadata
indicating what locales are available external to the main file. The format of this file is:
<data jsxnamespace="propsbundle" locales="externalLocales">
<!-- the default locale -->
<locale>
<record jsxid="propId" jsxtext="propValue"/>
...
</locale>
<!-- additional locales -->
<locale key="en_US">
<record jsxid="propId" jsxtext="propValueEnUs"/>
...
</locale>
...
</data>
externalLocales is a comma-separated list of locales that are available for this properties bundle that
are defined in separate files. By spreading a properties bundle over many files, loading a bundle for a single
locale is optimized. For each locale, locKey, listed in externalLocales, there must be a file
fileName.locKey.ext in the same directory as the main bundle file.
Each external file has the same format as the main file except that the locales attribute of
the data tag should not be specified. Any number of locales can be defined. The first locale defined
should be the locale explicit in the name of the file. Only more specific locales should follow this locale.
For example, file props.es.xml, should start by defining locale es and could continue
with locales es_ES and es_MX but should not define locales fr or
de.| Method Summary | |
|---|---|
| static void | Clears all the data stored in the caches internal to this class. |
| jsx3.app.Locale | Returns the locale for which this properties object was created. |
| String | getPath() Returns the base path of this properties bundle. |
| static jsx3.app.PropsBundle | getProps(strBasePath : String | jsx3.net.URI, objLocale : jsx3.util.Locale, objCache : jsx3.app.Cache) Returns a properties object representing a localized view onto a properties bundle. |
| Methods Inherited From jsx3.app.Properties |
|---|
| addParent, containsKey, get, getKeys, getParents, loadXML, remove, removeAllParents, removeParent, set |
| Methods Inherited From jsx3.lang.Object |
|---|
| clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf, toString |
| Method Detail |
|---|
getProps()
consult only these caches. If files have changed on disk this method must be called for the return value of
getProps() to reflect these changes.strPath.strPath, clear out any documents
stored in objCache associated with the resource at path strPath.
getProps() method and not necessarily the most specific locale for which the
properties in this view are defined.