Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 85918 invoked by uid 500); 29 Oct 2001 23:28:53 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 85902 invoked from network); 29 Oct 2001 23:28:50 -0000 From: "Neeme Praks" To: , Subject: Avalon i18n support updated (also a small patch for I18nTransformer) Date: Tue, 30 Oct 2001 01:29:04 -0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0019_01C160E2.42BE07B0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------=_NextPart_000_0019_01C160E2.42BE07B0 Content-Type: text/plain; charset="iso-8859-4" Content-Transfer-Encoding: 7bit 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 ------=_NextPart_000_0019_01C160E2.42BE07B0 Content-Type: text/plain; name="diff.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="diff.txt" Index: I18nTransformer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/transformation/I18nTran= sformer.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:=20 --- > * ie: 157c157 < *
  • For date, date-time and time the pattern and src-pattern = attribute=20 --- > *
  • For date, date-time and time the pattern and src-pattern = attribute 333,334c333,334 < private XMLResourceBundle dictionary; < private XMLResourceBundleFactory factory =3D new = XMLResourceBundleFactory(); --- > private ResourceBundle dictionary; > private ResourceBundleSelector selector; 381,383d380 <=20 < // activate resource bundle logging < factory.setLogger( getLogger() ); 389c386 < * to get language user has selected.=20 --- > * 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 =3D manager.lookup(ResourceBundleSelector.ROLE); ------=_NextPart_000_0019_01C160E2.42BE07B0 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org ------=_NextPart_000_0019_01C160E2.42BE07B0--