You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Giles Paterson <gp...@silacom.com> on 2000/12/08 17:21:49 UTC

[C2] Sitemap and multilanguages

Okay this is a query about using C2 but this seems to be the most
appropriate forum for such  questions...

I have a desire to produce a multilingual website but I am not sure the best
way to progress with cocoon2.

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.


If we weren't to match on the locale, would it be possible to match on a
cookie or URL parameter (e.g. lang=fr)?

Does anyone have any suggestions/examples as to the best way to proceed?

If it requires writing a new Factory (i.e. LocaleSelectorFactory) then I'm
not adverse to doing it.

TIA,

--
Giles Paterson 

[C2]: Patch for poolable Serializers

Posted by Carsten Ziegeler <cz...@sundn.de>.
Hi,

happy new year to all of you!

Attached is a very simple patch for the XMLSerializer and TextSerializer to make them poolable.


Carsten


Open Source Group              sunShine - Lighting up e:Business
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de                           mailto:cziegeler@sundn.de 
================================================================

Re: [C2] Sitemap and multilanguages

Posted by Marcus Crafter <cr...@dresdnerbank.de>.
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 -->
	 </match>
	<serialize/>

	(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"/>
	<serialize/>

	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. :-)

	Cheers,

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