Askild Aaberg Olsen wrote:

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:generate>
        <map:transform type="xslt" src="match.lang.xslt">
                <map:parameter name="lang" value="{request-param:lang}"/>
                <map:parameter name="path" value="{1}"/>
        </map:transform>
        <map:transform type="cinclude"/>
        <map:serialize type="xml"/>
</map:match>

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


Now that is interesting. If you instead did:

        <map:act type="locale">
                <map:transform type="xslt" src="match.lang.xslt">
                        <map:parameter name="request-lang" 
value="{request-param:lang}"/>
                        <map:parameter name="locale-lang" value="{locale:lang}"/>
                        <map:parameter name="path" value="{1}"/>
                </map:transform>
        </map:act>

You would be able to code your stylesheet to handle the locale provided by the user's browser, not just a request parameter. Would you be willing to post (or send me privately) your stylesheet as it currently stands?

It works, but it's not rock-solid.

It looks good to me, so far.

A cocoon component that implements this
would be really useful!


Yea. But there's also something to be said for the simple component approach that you've taken. I'll mull on this more.

Regards, Upayavira



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to