cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira>
Subject Re: I18N and multiple source files
Date Tue, 16 Mar 2004 09:58:53 GMT
Vadim Gritsenko wrote:

> Upayavira wrote:
>> It seems that Cocoon's I18N code is more geared towards 
>> internationalisation of 'webapps' rather than static sites.
>> It deals with menu items, etc, taking the various translations from 
>> catalog files, as necessary.
>> However, when you want to build a static site, where the entire 
>> content is in different languages, you need a way to pick the right 
>> file at the generator stage.
> I think you missed LocaleAction.
> ...
>> Two other areas that it should support:
>> (1) If the user specifies preferences in terms of locale, it should 
>> serve back the page most suiting their preference, e.g they might 
>> supply de, en, saying they prefer German, but English would be okay.
>> (2) If a translation in the user's language does not exist, it should 
>> offer a page in the 'default' language.
> From this description it sound like combination of LocaleAction and 
> ResourceExistAction is what you need. 

Or ResourceExistsSelector, and the globals input module:


  <map:match pattern="**/*.html">
    <map:act type="locale">
     <map:select type="resource-exists">
       <map:when test="{../1}/{../2}.{lang}-{country}.xml">
           <map:generate src="{../1}/{../2}.{lang}-{country}.xml"/>
        <map:when test="{../1}/{../2}.{lang}.xml">
           <map:generate src="{../1}/{../2}.{lang}.xml"/>
          <map:generate src="{../1}/{../2}.{global:default-lang}.xml"/>
    <map:transform src="....."/>

So, the globals input module allows you to specify the default language, 
and you can build up your page name. Oh for the arrival of virtual 
sitemap components, this would make such a neat one: the i18nGenerator.

Thanks so much for this Vadim - I think this gets us pretty much where 
we want to go.

Regards, Upayavira

View raw message