You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by h e n r i k <he...@xl-studio.se> on 2000/11/20 16:56:01 UTC

Multilingual solution?

Hi all.

Any suggestions on the "best" way to create a multiligual site with
dynamic content?

1. Using XSP with tons of "if xml:lang == 'en' or else blah..." 
2. Using XSLT to strip foreign elements 
3. Multiple files, one for each language

Suggestions?

/ h e n r i k

Re: Multilingual solution?

Posted by Lassi Immonen <li...@malla.urova.fi>.
h e n r i k wrote:
> 
> Hi all.
> 
> Any suggestions on the "best" way to create a multiligual site with
> dynamic content?
> 
> 1. Using XSP with tons of "if xml:lang == 'en' or else blah..."
> 2. Using XSLT to strip foreign elements
> 3. Multiple files, one for each language
> 
> Suggestions?

Hi Henrik,

We are currently using C2 to produce multilingual site in two ways.

1. Action, which parses language to lang parameter which is available to
Cocoon environment ie.
--sitemap.xmap--
<map:match pattern="mysite/file">
	<map:act type="lang_select">
		<map:generate src="mysite/file_{1}.xml"/>
   	</map:act>
</map:match>

{1} = en,fi,sv etc.

2. Transformer, which checks if xml-file has any tags that have to be
translated and if so, replaces the translation in place.

example:
--sitemap.xmap--
<map:match pattern="login">
	<map:generate type="serverpages" src="login.xsp"/>
	<map:transform type="translate">
		<parameter name="default_lang" value="fi"/>
		<parameter name="src" 
			value="translations/login_trans.xml"/>    
	</map:transform>

   	<map:transform src="login2html.xsl"/>
	<map:serialize type="html"/>
</map:match>

--login_trans.xml--
...
<entry>
	<key>Käyttäjätunnus</key>
	<translation lang="en">Username</translation>
</entry>
...

(we currently have all translations in same file, but it might be better
to separate translations to file/language)

--login.xsp--
xmlns:i="http://apache.org/cocoon/i18n"
...
<value><i:tr>Käyttäjätunnus</i:tr></value>
...

which get translated to "Username" if login page is requested in
english.


I think these two ways are enough to us anyway. 
Hope this helps. 

 Lassi Immonen

Re: AW: Multilingual solution?

Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
Hi!

There was some discussing about it a month ago.
You can look in the archives for Internationalization.

I use FP tag lib for internationalization.
All international stuff I keep in one or more XML files like this:
<abs>
    <repository lang="en">
        <form>
            <title>English title</title>
        </form>
    </repository>

    <repository lang="ru">
        <form>
            <title>??????? ?????????</title>
        </form>
    </repository>

</abs>

Then I declare the resource file for FP taglib using the lang attribute
which I get from either the user's session or request params. (see FP taglib
docs for syntax)

Then I create an XSP where I place FP tags for international data:

<fp:read select="form/title" as="string"/>

It is convenient also for international data for international lists (HTML
selects).
I can put this in the dictionary file:

<country>
    <list>
        <item value="us">USA</item>
        <item value="ru">Russia</item>
        <item value="">Other</item>
    </list>
</country>

And read the whole node:

<fp:read select="country" as="node"/>

Another aproach is to use a translation processor.
There is one available at the Infozone:
http://www.infozone-group.org/index.html

Regards,
    Konstantin Piroumian.

----- Original Message -----
From: "h e n r i k" <he...@xl-studio.se>
To: <co...@xml.apache.org>
Sent: 21 ?????? 2000 ?., ??????? 13:06
Subject: Re: AW: Multilingual solution?


>
> > > Any suggestions on the "best" way to create a multiligual site with
> > > dynamic content?
> > >
> > > 1. Using XSP with tons of "if xml:lang == 'en' or else blah..."
> > > 2. Using XSLT to strip foreign elements
> > > 3. Multiple files, one for each language
> > >
> > > Suggestions?
> >
> > Months ago I wanted start such a thread but didn't get much feedback.
>
>
> Too bad, I think this is a major issue!
>
>
> > I would consider (2) or (3) depending on how complex the pages
> > gonna be. At least under Cocoon1 large XML files get slooooow
> > because of the big DOM tree. So (3) might be prefered.
> > But if your XSP is inside your content XML you have to have
> > the same logic in every page. If you do not have too many
> > languages and put most of the logic in taglibs it might be ok.
> >
> > An other option: the clean page model (see the example that came
> > with cocoon) It separates the XSP from the content XML.
> >
> > (2) should be quite easy to handle and I guess I have
> > seen a transformer(?) for cocoon2 around that strips
> > all tags that are not for the requested language.
>
> Thanks for the tip, if I can find it I'll write it...
>
> / h e n r i k
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>

Re: AW: Multilingual solution?

Posted by h e n r i k <he...@xl-studio.se>.
> > Any suggestions on the "best" way to create a multiligual site with
> > dynamic content?
> >
> > 1. Using XSP with tons of "if xml:lang == 'en' or else blah..."
> > 2. Using XSLT to strip foreign elements
> > 3. Multiple files, one for each language
> >
> > Suggestions?
> 
> Months ago I wanted start such a thread but didn't get much feedback.


Too bad, I think this is a major issue!


> I would consider (2) or (3) depending on how complex the pages
> gonna be. At least under Cocoon1 large XML files get slooooow
> because of the big DOM tree. So (3) might be prefered.
> But if your XSP is inside your content XML you have to have
> the same logic in every page. If you do not have too many
> languages and put most of the logic in taglibs it might be ok.
> 
> An other option: the clean page model (see the example that came
> with cocoon) It separates the XSP from the content XML.
> 
> (2) should be quite easy to handle and I guess I have
> seen a transformer(?) for cocoon2 around that strips
> all tags that are not for the requested language.

Thanks for the tip, if I can find it I'll write it...

/ h e n r i k

Struts comparison?

Posted by HuiSion Teh <hu...@mailandnews.com>.
hi
Anyone has any experince with Apache Struts framework
http://jakarta.apache.org/struts ?
How does it compare with Cocoon?
Thanks


AW: Multilingual solution?

Posted by Torsten Curdt <tc...@dff.st>.
> Hi all.
> 
> Any suggestions on the "best" way to create a multiligual site with
> dynamic content?
> 
> 1. Using XSP with tons of "if xml:lang == 'en' or else blah..." 
> 2. Using XSLT to strip foreign elements 
> 3. Multiple files, one for each language
> 
> Suggestions?

Months ago I wanted start such a thread but didn't get much feedback.

I would consider (2) or (3) depending on how complex the pages
gonna be. At least under Cocoon1 large XML files get slooooow
because of the big DOM tree. So (3) might be prefered.
But if your XSP is inside your content XML you have to have
the same logic in every page. If you do not have too many
languages and put most of the logic in taglibs it might be ok.

An other option: the clean page model (see the example that came
with cocoon) It separates the XSP from the content XML.

(2) should be quite easy to handle and I guess I have
seen a transformer(?) for cocoon2 around that strips
all tags that are not for the requested language.

My 2 cents
--
Torsten