cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Crafter <>
Subject Re: [C2] Sitemap and multilanguages
Date Fri, 08 Dec 2000 17:42:22 GMT
Hi Giles,

On Fri, 8 Dec 2000, Giles Paterson wrote:

> We have a site running under cocoon2 quite happily and I thought the best
> way to multilingualise it would be to use the sitemap to match on the
> browser locale in a similar manner to the way you can get it match on the
> user agent and use the appropriate language-specific xml file. Okay this
> means having separate xml files for each language but for a lot of languages
> (as we will have) I believe that is better than one xml file with multiple
> languages within it.
> Does anyone have any suggestions/examples as to the best way to proceed?

	We developed our application initially using Cocoon 1, and implemented
	a set of Xalan extensions for internationlization. Our extensions
	match based on the locale of the browser via it's headers.

	Instead of raw text, we write <dxsl:msg key="somekey"/> in our
	stylesheets, and the tags get replaced by Xalan, using java's standard
	resource bundle classes.

	I know it's not a C2 solution to the issue, which is why I've had a
	sleeping thread in my brain for a while about how to handle i18n
	in C2. Your email has woken it up. :-)

	I think a locale selector is *not* the right way to go. This leads to
	an implicit set of 'if locale fr, else if locale en, else...'.
	Maintenance nightmare.

	How do you want to store your messages ? Using java bundles ? Or
	separate stylesheets/xml files ? or some other format ?

	If you're using separate stylesheets, consider a locale matcher:

	<generate type="serverpages" src="myfile.xml"/>
	 <transform src="style1.xsl"/>
	 <transform src="style2.xsl"/>
	 <match type="locale" pattern="ununsed">
	  <transform src="final_{1}.xsl"/>   <!-- stylesheet by locale -->

	(note 1, you'll need to cover the situation where the locale
	returned is not covered by your set of supported locales)

	(note 2, if Giacomo's List->Map return type suggestion gets approved,
	you'll be able to say <transform src="final_{locale}.xsl"/> instead)

	If you're using java's bundles, then consider an i18n transformer:

	<generate type="serverpages" src="myfile.xml"/>
	 <transform src="style1.xsl"/>
	 <transform src="style2.xsl"/>
	 <transform type="i18n" src="final.xsl"/>

	The transformer could replace specific tags with text, similar to the
	Xalan solution we're currently using.

	In both cases, adding support for new languages does not require any
	further changes to the sitemap. I think this is a big win.

	Anyway, just some random thoughts, as I'm also reconsidering our
	current Xalan based approach in favour of a more coherent C2 approach.
	I'm sure the others will have suggestions too.

	Hope that's at least a start for you. :-)


     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email :
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:           After Hours    : +49 69 49086750

View raw message