cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Royal <>
Subject Re: [RTl] i18n transformer
Date Fri, 26 Oct 2001 14:24:10 GMT
At 02:39 PM 10/25/2001 +0200, you wrote:
>  b)Maybe a bit nicer sollution could be to have an
>     interface I18nDictonary {
>        public String lookup( String key );
>        public long getLastModified();
>     }
>    A helper class could delegate the lookup to the original
>    XMLResourceBundle. If the getLastModified() is available
>    making the I18nTransformer cacheable should be really easy,
>    too. Cacheability would only depend on the features of
>    the dictonary then.

I've already implemented something like that locally here, I just haven't 
had a chance to port it back to the C2 tree and send a patch. Looks like 
its needed tho :)

What I did:

I made an I18nResourceFactory component that returns XMLResourceBundles's :

XMLResourceBundle select(String name, Locale locale) throws ComponentException;

That component can be configured in cocoon.xconf with 2 parameters:
         catalogue-location - the base directory to search for catalogues
         cache-at-startup - same as XmlResourceBundle option

The I18nTransformer then uses the I18nResourceFactory to load its 
XMLResouceBundles, thus having a single instance of each XMLResourceBundle 
in memory.

I also gave the transformer some new options:
         untranslated-text - set the text to insert if no translation is 
found and no default. Can be an expression such as "[ut: $key]" where $key 
was the attempted lookup key.
         catalogue - this specifies which catalogue to request from the 
         ignore-no-catalogue - If the specified catalog cannot be found, 
supress the error.

This is all against the 2.0 branch, as that is what we've been tracking 
here. If interest is high I'll make a patch quicker :)

peter royal ->
managing partners, inc. ->

To unsubscribe, e-mail:
For additional commands, email:

View raw message