You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by sudhi <su...@planet.net> on 2000/05/24 23:06:33 UTC

Some questions.

Hi All,
I am very new to cocoon. I did play around with it a little. And I
really like it a lot. Thanks to all the people who created it :-).
How ever I have two questions regarding Cocoon.

1. For example, if I build a multi lingual web site, which displays the
contents in different languages, How does Cocoon fit in ? What do I have
to do to serve multi lingual pages. 

2. I have a bunch of xml files. And I want search those xml files for
some content. Whats the best way to do it ? Does Cocoon has anything for
it ?
Or do I have to write my own search engine kind of code ?

Thanks in advance
Sudhi

Re: Some questions.

Posted by Mike Engelhart <me...@earthtrip.com>.
on 5/26/00 10:56 AM, sudhi at sudhi@planet.net wrote:

> Do you guys mind if I join the conversation with you guys :-) ?
No problem!  

Mike


Re: Some questions.

Posted by sudhi <su...@planet.net>.
Do you guys mind if I join the conversation with you guys :-) ?

Re: Some questions.

Posted by Mike Engelhart <me...@earthtrip.com>.
on 5/26/00 4:08 AM, Darren Scott at dscott@bluecheese.co.uk wrote:

> sudhi wrote:
>> In this case you got to have all the content for different languages in
>> the same xml document. How do you handle different charset (encoding)?
> 
> Good point. I hadn't even considered that yet. I'm just glad I got a
> barebones solution working :)
> 
> Perhaps Mike Engelhart has some thoughts - I might venture to talk to
> him offlist if he doesn't mind an unsolicited email.

Sure send away! Because of time constraints, I had to give up on my XML
based solution to this.  As I may have mentioned I'm using Java's language
support by using ResourceBundle's which handles most of the nasties
involved.  I fully planned on using an XML/XSL solution but as of this point
it doesn't suit my needs (i.e. storing language specific context outside of
the XSL document. 
As for charsets, I believe that ResourceBundle's handle this properly as
they are java so they should be just pure Unicode.  Since i have only
attempted 5 western european languages in my testing I don't know how it
would work with say an arabic language.

> 
>> One other thing is microsoft IE5 returns
>> 
>> accept-language : en-us
>> 
>> where as Netscape
>> 
>> accept-language : en
>> 
>> Thats going to cause lot of problems ( Supporting all browsers).
> 
> Hmm, you're right. I must admit to not being up-to-date with servlet
> API, but I seem to recall >2.0 having some localization support - maybe
> it deals with that issue a bit more intelligently. I'll look into it.
The current Tomcat (3.1 Final) supports the different browsers very nicely.
I haven't run into any problems with any of the Windows, Mac or Linux
browsers that I've used as far as figuring out what language to support.


Mike 


Re: Some questions.

Posted by Darren Scott <ds...@bluecheese.co.uk>.
sudhi wrote:
> In this case you got to have all the content for different languages in
> the same xml document. How do you handle different charset (encoding)?

Good point. I hadn't even considered that yet. I'm just glad I got a
barebones solution working :)

Perhaps Mike Engelhart has some thoughts - I might venture to talk to
him offlist if he doesn't mind an unsolicited email.

> One other thing is microsoft IE5 returns
> 
> accept-language : en-us
> 
> where as Netscape
> 
> accept-language : en
> 
> Thats going to cause lot of problems ( Supporting all browsers).

Hmm, you're right. I must admit to not being up-to-date with servlet
API, but I seem to recall >2.0 having some localization support - maybe
it deals with that issue a bit more intelligently. I'll look into it.

> Any ways thanks for those taglibs. :-)

No probs - thanks for sharing your thoughts :)

Darren Scott
Production Director
bluecheese.co.uk

Re: Some questions.

Posted by sudhi <su...@planet.net>.
Thats nice,
In this case you got to have all the content for different languages in
the same xml document. How do you handle different charset (encoding)?

One other thing is microsoft IE5 returns 

accept-language : en-us

where as Netscape 

accept-language : en

Thats going to cause lot of problems ( Supporting all browsers).

Any ways thanks for those taglibs. :-)
Sudhi

Darren Scott wrote:
> 
> Darren Scott wrote:
> > > I too have built a multi-lingual site using Xalan extensions and Java's
> > > built-in ResourceBundle system
> > > What is the backend to your taglib if you don't mind me asking?  Are you
> > > using key/map in Xalan?
> >
> > A couple of people have asked me to post it - I will, but I want to work
> > on it a little more first.
> 
> Ah,
> 
> I finally got where I wanted. Still having trouble shifting to the
> document paradigm ;)
> 
> The Logicsheet now returns the language most preferred by the user, or a
> default if no preference is made or none of the users preferred
> languages are found.
> 
> Perhaps any interested parties might make some comments on the logic of
> the Logicsheet and my choice of markup (sorta looks ugly).
> 
> Does the mailing list let attachments through?
> 
> I'll put them on the web somewhere if they don't get through.
> 
> Take care, folks, I'm going home.
> 
> Darren Scott
> Production Director
> bluecheese.co.uk
> 
>   ------------------------------------------------------------------------
> <?xml version="1.0"?>
> <xsl:stylesheet
>   version="1.0"
>   xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
>   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>   xmlns:accept-language="http://www.bluecheese.co.uk/XSP/Accept-Language"
> >
> 
> <xsl:template match="xsp:page">
>  <xsp:page>
>   <xsl:copy>
>    <xsl:apply-templates select="@*"/>
>   </xsl:copy>
>   <xsp:logic>
>     String pref_lang;
>     String accept_lang;
>     StringTokenizer st;
>     boolean done;
>   </xsp:logic>
>   <xsl:apply-templates/>
>  </xsp:page>
> </xsl:template>
> 
> <xsl:template match="accept-language:translations">
>  <xsp:logic>
>    accept_lang = request.getHeader("accept-language");
>    if (accept_lang==null) accept_lang = "";
>    accept_lang+=","+<xsl:text>"</xsl:text><xsl:value-of select="@default"/><xsl:text>"</xsl:text>;
>    st = new StringTokenizer(accept_lang,",");
>    done = false;
>    while (st.hasMoreTokens() &amp;&amp; !done) {
> 
>      pref_lang = st.nextToken().trim();
> 
>  </xsp:logic>
>  <xsl:for-each select="accept-language:translation">
>  <xsp:logic>
> 
>      if (pref_lang.equals(<xsl:text>"</xsl:text><xsl:value-of select="@language"/><xsl:text>"</xsl:text>)) {
> 
>        <xsp:content>
>         <xsl:apply-templates select="node()"/>
>        </xsp:content>
>        done = true;
>      }
> 
>   </xsp:logic>
>  </xsl:for-each>
>  <xsp:logic>
>    }
>  </xsp:logic>
> </xsl:template>
> 
> <xsl:template match="@*|node()" priority="-1">
>  <xsl:copy>
>   <xsl:apply-templates select="@*|node()"/>
>  </xsl:copy>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
>   ------------------------------------------------------------------------
> <?xml version="1.0"?>
> <?xml-stylesheet href="debug.xsl" type="text/xsl?>
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>
> <xsp:page
>  language="java"
>  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>  xmlns:accept-language="http://www.bluecheese.co.uk/XSP/Accept-Language"
> >
> 
>  <mypage>
> 
>   I think you should see the page:-
> 
>   <accept-language:translations default="fr">
>    <accept-language:translation language="en">
>      In English
>    </accept-language:translation>
>    <accept-language:translation language="fr">
>      En Francais
>    </accept-language:translation>
>   </accept-language:translations>
> 
>  </mypage>
> 
> </xsp:page>
> 
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: Some questions.

Posted by Darren Scott <ds...@bluecheese.co.uk>.
Darren Scott wrote:
> > I too have built a multi-lingual site using Xalan extensions and Java's
> > built-in ResourceBundle system
> > What is the backend to your taglib if you don't mind me asking?  Are you
> > using key/map in Xalan?
> 
> A couple of people have asked me to post it - I will, but I want to work
> on it a little more first.

Ah,

I finally got where I wanted. Still having trouble shifting to the
document paradigm ;)

The Logicsheet now returns the language most preferred by the user, or a
default if no preference is made or none of the users preferred
languages are found.

Perhaps any interested parties might make some comments on the logic of
the Logicsheet and my choice of markup (sorta looks ugly).

Does the mailing list let attachments through?

I'll put them on the web somewhere if they don't get through.

Take care, folks, I'm going home.

Darren Scott
Production Director
bluecheese.co.uk

Re: Some questions.

Posted by Darren Scott <ds...@bluecheese.co.uk>.
Mike Engelhart wrote:
> Hey Darren,
> I too have built a multi-lingual site using Xalan extensions and Java's
> built-in ResourceBundle system
> What is the backend to your taglib if you don't mind me asking?  Are you
> using key/map in Xalan?

Mike,

It doesn't use a backend - it is a taglib which selects the most
appropriate source tree fragments based on the user-agent's language
header.

I am working on the assumption that translations are kept in the same
document, but I guess it could be used to include different external
files - I haven't experimented properly yet.

A couple of people have asked me to post it - I will, but I want to work
on it a little more first. 

Regards

Darren Scott
Production Director
bluecheese.co.uk

Re: Some questions.

Posted by Mike Engelhart <me...@earthtrip.com>.
on 5/25/00 9:15 AM, sudhi at sudhi@planet.net wrote:

> Hey guys,
> I would really appreciate, if you guys could tell me how to go about it.
> Since I am very new to Cocoon and even xml. Any help would be really
> appreciated.
> Thanks in advance
> Sudhi
There are a bunch of my rambling postings in the archives about using
ResourceBundle's and Xalan extensions.  I don't have time right now to
rewrite them but they are in there.  Just search for my name.

mike


Re: Some questions.

Posted by sudhi <su...@planet.net>.
Hey guys,
I would really appreciate, if you guys could tell me how to go about it.
Since I am very new to Cocoon and even xml. Any help would be really
appreciated.
Thanks in advance
Sudhi

Mike Engelhart wrote:
> 
> on 5/25/00 3:51 AM, Darren Scott at dscott@bluecheese.co.uk wrote:
> 
> > I am working on a multilingual taglib at the moment. So far, it will
> > display the site in the users preferred language according to the
> > 'accept-language' header, but it doesn't display the users next choice
> > if that language isn't available and so on - which is the part I am
> > working on now.
> >
> > It should not be very long before I'm done, and it will make maintaining
> > multilingual sites a pop.
> Hey Darren,
> I too have built a multi-lingual site using Xalan extensions and Java's
> built-in ResourceBundle system
> What is the backend to your taglib if you don't mind me asking?  Are you
> using key/map in Xalan?
> 
> thanks
> 
> Mike
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: Some questions.

Posted by Mike Engelhart <me...@earthtrip.com>.
on 5/25/00 3:51 AM, Darren Scott at dscott@bluecheese.co.uk wrote:

> I am working on a multilingual taglib at the moment. So far, it will
> display the site in the users preferred language according to the
> 'accept-language' header, but it doesn't display the users next choice
> if that language isn't available and so on - which is the part I am
> working on now.
> 
> It should not be very long before I'm done, and it will make maintaining
> multilingual sites a pop.
Hey Darren,
I too have built a multi-lingual site using Xalan extensions and Java's
built-in ResourceBundle system
What is the backend to your taglib if you don't mind me asking?  Are you
using key/map in Xalan?

thanks

Mike


Re: Some questions.

Posted by Darren Scott <ds...@bluecheese.co.uk>.
sudhi wrote:
> 1. For example, if I build a multi lingual web site, which displays the
> contents in different languages, How does Cocoon fit in ? What do I have
> to do to serve multi lingual pages.

I am working on a multilingual taglib at the moment. So far, it will
display the site in the users preferred language according to the
'accept-language' header, but it doesn't display the users next choice
if that language isn't available and so on - which is the part I am
working on now.

It should not be very long before I'm done, and it will make maintaining
multilingual sites a pop.

Darren Scott
Production Director
bluecheese.co.uk