You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Neeme Praks <ne...@inpoc.com> on 2001/10/30 10:29:04 UTC

Avalon i18n support updated (also a small patch for I18nTransformer)

I made some major updates to the Avalon i18n support, to make it less
coupled to XMLResourceBundle and to provide hooks for extending the base
functionality. Short summary of the changes:
----------
* added org.apache.avalon.excalibur.i18n.ResourceBundle "behavioral"
interface
* moved all non XMLResourceBundle specific code to AbstractResourceBundle
* made XMLResourceBundle methods more "extendable-friendly" (private vs.
protected methods)
* added FlatXMLResourceBundle class (extends XMLResourceBundle) that
provides support for bundles with the "flat" XML schema that Cocoon i18n
transformer currently uses. this should also work as an example of how to
extend the base implementations.
* added getLastModified() method that Torsten mentioned.
---
* added org.apache.avalon.excalibur.i18n.LocaleToUriMapper "behavioral"
interface, to make it easy to implement different mappings
* added abstract base-class PrefixedMapper that provides base for different
"prefixed" implementations (prefix = root directory under current
implementations, but not always).
* moved the default mapping implementation code from XMLResourceFactory to
DefaultMapper class (that extends PrefixedMapped)
* added one more mapping implementation that I had in one corner of by disk,
DirectoryMapper
---
* renamed XMLResourceBundleFactory into ResourceBundleSelector as all the
XMLResourceBundle specific code was moved out from there and it is generic
enough now.
----------

That should be all for today, should get some sleep now. It compiles, but I
didn't have time to test it yet... So, if anyone feels adventurous, feel
free to check it out, the code is in Avalon Excalibur scratchpad.

I also tried to rewrite I18nTransformer to cope with the changes, I'll
attach my preliminary diff. Most probably it still needs some more tweaking
to get it 100% working again. Unfortuantely by Cocoon2 copy refuses to
compile right now... and I don't have time right now to investigate
further...

In the process, I also got some questions about Avalon and how Cocoon
relates to it:
* I made ResourceBundleSelector Composable... how does Cocoon get a hold of
ResourceBundleSelector? manager.lookup(String role)?
* if Cocoon should use manager.lookup(String role), who takes care of the
lifecycle methods like setting the logger and configuring that beast? Where
should I stick the configuration entries?

Also, I did't want to dig very deep into I18nTransformer right now, but I
would like the I18nTransformer to make it take advantage of more
ResourceBundle features and maybe also move some of the code from
I18nTransformer to more generic ResourceBundle (I saw some Date/Time i18n
support in I18nTransformer, maybe could be something worth looking at?)

All for now...
Neeme