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
Index: I18nTransformer.java =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/transformation/I18nTransformer.java,v retrieving revision 1.23 diff -r1.23 I18nTransformer.java 25,26c25,26 < import org.apache.cocoon.i18n.XMLResourceBundle; < import org.apache.cocoon.i18n.XMLResourceBundleFactory; --- > import org.apache.avalon.excalibur.i18n.ResourceBundle; > import org.apache.avalon.excalibur.i18n.ResourceBundleSelector; 94c94 < * ie: --- > * ie: 157c157 < * <li>For date, date-time and time the pattern and src-pattern attribute --- > * <li>For date, date-time and time the pattern and src-pattern attribute 333,334c333,334 < private XMLResourceBundle dictionary; < private XMLResourceBundleFactory factory = new XMLResourceBundleFactory(); --- > private ResourceBundle dictionary; > private ResourceBundleSelector selector; 381,383d380 < < // activate resource bundle logging < factory.setLogger( getLogger() ); 389c386 < * to get language user has selected. --- > * to get language user has selected. 400c397 < // configure the factory --- > // configure the selector 415c412 < (XMLResourceBundle) factory.select( catalogueName, locale ); --- > (ResourceBundle) selector.select( catalogueName, locale ); 434c431 < * configuration object directly to XMLResourceBundle. --- > * configuration object directly to ResourceBundle. 438c435 < // configure the factory to log correctly and cache catalogues --- > // configure the selector to log correctly and cache catalogues 443c440 < XMLResourceBundleFactory.ConfigurationKeys.CACHE_AT_STARTUP, --- > ResourceBundleSelector.ConfigurationKeys.CACHE_AT_STARTUP, 452c449 < XMLResourceBundleFactory.ConfigurationKeys.ROOT_DIRECTORY, --- > ResourceBundleSelector.ConfigurationKeys.ROOT_DIRECTORY, 466c463 < factory.configure( configuration ); --- > selector = manager.lookup(ResourceBundleSelector.ROLE);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]