From: "Mato Mira, Fernando" <[EMAIL PROTECTED]>
> > From: Konstantin Piroumian [mailto:[EMAIL PROTECTED]
> >
> > Don't quite understand what does it mean e.g. messages_biochemical
> > hierarchy, but if you want to use multiple catalogs and
> > search for a message
> > one-by-one then you should take a look at i18n transformer
> > configuration in
> > i18n samples. Not sure that it is what you are looking for,
> > but thanks to
> > Bruno now we can have one default and several other
> > catalogues used with the
> > same pipeline.
>
> I don't want to search messages one by one, I want to transform a whole
> document like this (I used the term hierarchy as in the documentation):
>
> 1. Find one catalog among
> message_novartis_language_country_variant.xml
> message_novartis_language_country.xml
> message_novartis_language.xml
> message_novartis.xml (I wouldn't use this so as not to mix languages)
>
> and search
>
> 2. If key not found, find one catalog among
> message_biochemical_language_country_variant.xml
> message_biochemical_language_country.xml
> message_biochemical_language.xml
> message_biochemical.xml (I wouldn't use this so as not to mix
languages)
>
> and search
>
> 3. If key not found, find one catalog among
> message_language_country_variant.xml
> message_language_country.xml
> message_language.xml
> message.xml
>
> and search
>
>
> Of course the ideal would be:
>
> Search existing message catalogs until a hit found:
> message_novartis_language_country_variant.xml
> message_biochemical_language_country_variant.xml
> message_language_country_variant.xml
> message_novartis_language_country.xml
> message_biochemical_language_country.xml
> message_language_country.xml
> message_novartis_language.xml
> message_biochemical_language.xml
> message_language.xml
> message_novartis.xml
> message_biochemical.xml
> message.xml
Now I see what you mean.
Take a look at these lines in i18n samples:
<map:transformer name="i18n" logger="sitemap.transformer.i18n"
src="org.apache.cocoon.transformation.I18nTransformer">
<catalogues default="messages">
<catalogue id="messages" name="messages" location="translations"/>
<catalogue id="menu" name="menu" location="translations"/>
</catalogues>
This maybe would help you a little bit, but it's not what you are looking
for. You can now configure multiple bundles and specify the name to use in
your XML, e.g. <i18n:text bundle="menu">Key</i18n:text>. The default
catalogue is used in case you don't specify any bundle.
Hm... Maybe we can change that behavior to be this:
- look for translation in the specified catalogue, if not found
- look for it in the default catalogue
What others think which is the most useful approach for key-not-found
fallbacks?
-- Konstantin