cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Askild Aaberg Olsen" <>
Subject Re: Cocoon and Internationalization
Date Tue, 11 May 2004 13:34:54 GMT
Upayavira wrote:
> > We have successfully used Cocoon on several "DOCUMENT oriented"
> > multi-lingual sites.  In our experience we have found that i18n is 
> > good  for internationalizing our application but not our content.   
> > The text  that is part of the APPLICATION (menu bars, headings, 
> > navigation aides  etc) is all controlled under the i18n umbrella.   
> > The CONTENT however  is simply marked up with language identifying 
> > tags.   We did this for a  couple of reasons.   One was 
> outlined below 
> > in that i18n isn't really  designed for whole documents but rather 
> > bits and pieces.  The second  reason was that we wanted to keep our 
> > content "pure" separate from any  application specific mechanisms.  
> > This way our content stands alone and  is ready to be used 
> or served 
> > by any system.  Whether or not the  translated content is 
> in a single 
> > file per document or individual  language files is 
> completely a design 
> > choice.  We have done it both  ways.
> This is the sort of thing that is intended to be supported by 
> what I am 
> working on. Unfortunately, contrary to what Sjur says, I haven't 
> finished it - I haven't really started it. It is a spare time 
> task, and 
> spare time has been taken up with other more personal stuff recently.
> But, what I want to do, is something like:
> <map:match pattern="**/*.html">
>   <map:generate src="{i18n:content/$locale/{1}/{2}.xml}"/>
>   ...
> </map:match>
> Where $locale is replaced, by this i18n module, with the name of the 
> relevant file, with the appropriate language. It would take 
> into account 
> such things as the locale first, dropping down to the appropriate 
> default until it finds a file, then maybe using a request parameter 
> lang="xxx", etc, until it finds a file, which it then serves up.
> Having described it like that, it doesn't actually seem that 
> hard to do! 
> Maybe I'll actually get it done some time soon!
> Upayavira

This is actually my current approach, but implemented with sitemap
parameters, a stylesheet and cinclude.

<map:match pattern="**/*.*">
	<map:generate type="directory" src="{1}">
		<map:parameter name="include" value="{2}_?(.*).{3}"/>
	<map:transform type="xslt" src="match.lang.xslt">
		<map:parameter name="lang" value="{request-param:lang}"/>
		<map:parameter name="path" value="{1}"/>
	<map:transform type="cinclude"/>
	<map:serialize type="xml"/>

The stylesheet implements the selection logic to find the correct file, and
if it doesn't find it, serves the closest match.

It works, but it's not rock-solid. A cocoon component that implements this
would be really useful!


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

View raw message