An implementation of the I18n interface, that loads the localized strings from a set of XML files.
| required components | FileSystem, XMLValidator, LoggerFactory, ConfigurationFactory |
|---|---|
| required libraries | DNA API (dna:dna-api) |
| position | type | descritpion |
|---|---|---|
| 1 | org.jcontainer.dna.Configuration |
the configuration |
| 2 | org.jcontainer.dna.Logger |
the logger |
| 3 | org.objectledge.filesystem.FileSystem |
the file system to access the templates |
| 4 | org.objectledge.xml.XMLValidator |
for validating the localization files. |
The name of the localization files must conform to the following regular expression:
[a-zA-Z0-9]*(\.[a-zA-Z0-9]+)*_[a-z]{2}_[A-Z]{2}\.xmlFirst part of the file name represents the namespace, second part, separated by the first underscore character is locale marker. Namespace elements are separated with dots, locale is composed of ISO language code and ISO country code. Language variants are not supported at this time.
Here's an example of namespace compositioning: Consider a file in the localization data directory named:
foo.bar_pl_PL.xml
<strings>
<prefix name="foo2">
<value>first_value</value>
<prefix name="bar2">
<prefix name="baz"><value>second_value</value></prefix>
</prefix>
</prefix>
</strings>second_value you should use the following key:
foo.bar.foo2.bar2.baz
first_value you should use the following key:
foo.bar.foo2