> From: Albert Cervera Areny [mailto:[EMAIL PROTECTED]] 
> 
> Hi,
>   the thread is quite old... but anyway, I've tried to make 
> the stylesheet

I've attached my version for comparison.

> (please tell me if it is right, by the way how could I avoid that
> xmlns:i18n in each generated tag?).

This should be somewhere in FAQs.

> I don't understand some things. I create a messages.xml file 
> which looks
> like (I'd prefer not to use simple keys but the original text, I don't
> think I can find a name for each element in the site):
> 
> <catalogue i18n:lang="ca">
>   <message key="maybe a very very long text">maybe a very very long
> text</message>
> </catalogue>

It's Ok, but don't forget about the perfomance.

> 
> That's right. This is the file in the same language as the 
> site. Then I
> make a couple of copies of it and name it messages_ca.xml 
> (the original
> language) and messages_es.xml (because I want to translate it into
> spanish). I translate this file:
> 
> <catalogue i18n:lang="es">
>   <message key="maybe a very very long text">translation of the
> text</message>
> </catalogue>
> 
> And now what? You said I don't need anything else but in the sitemap I
> need to tell only one dictionary... Do I need to merge both 
> files into one
> dictionary? How do I tell through the sitemap which language to use?

In sitemap you should specify at least two parameters on i18n transformer
declaration or directly in the pipeline as parameters of <map:transform
type="i18n"/>. The parameters are: catalogue-location and catalogue-name.
The catalogue-location should point to the directory where your dictionaries
are stored, the catalogue-name is the base name for the dictionary file (in
your case it's 'messages'). Then you should pass also 'locale' parameter
which you can get using either the LocaleAction or some URL pattern like
'path/{*}/file.xml' and URLs like 'path/es/file.xml'. Here is a snippet from
Cocoon's i18n sample sitemap:

<map:transform type="i18n">
        <!-- Override default catalog name for this pipeline. The catalogue
location is the same -->
        <map:parameter name="catalogue-name" value="menu"/>
        <map:parameter name="locale" value="{../locale}"/>
</map:transform>
                        
So, i18n transformer will select the needed dictionary depending on the
locale. See I18nTransformer and LocaleAction JavaDocs for details.

> I suppose you only create one messages file for the hole site merging
> multiple messages files... and you "refresh" it with another 
> stylesheet..
> am I right?

Exactly the opposite. I create multiple dictionary files in a form of
'messages_{lang}_{country}_{variant}.xml'. Usage of a master dictionary is
only a better way to keep dictionaries in sync with each other. (Reminder:
create a FAQ entry for this topic).

> 
> Well... can't think of more questions right now ;)

That's fine. If you had a look on Cocoon samples, i18n docs and JavaDocs
then you'll have much less questions than this, I suppose ;)

> 
> Thanks in advance!

No probs.

Konstantin

> 
> >> From: Albert Cervera Areny [mailto:[EMAIL PROTECTED]]
> >>
> >> Hi,
> >> I've been looking at the i18n transformer in the
> >> documentation web page,
> >> however I can't see how it works in production. I got the 
> idea that it
> >> works let's say like gettext as you mark which parts you want
> >> to translate
> >> and generate a file with those messages.... if so... how 
> can I do that
> >> easily? I've been looking throw those convert and merge xsl
> >> files but they
> >> don't seem to generate it. I was able to create a file to
> >> translate into
> >> one new language from the simple_dict.xml example but how may
> >> I create it
> >> from scratch?
> >
> > Seems that your are looking for my text2messages.xsl that I 
> have on my
> > harddrive at home ;). But I don't think that you'll have problems in
> > creating such a stylesheet yourself if you are familiar 
> with XSLT. You
> > just have to generate <message key="">text</message> 
> elements from the
> > all 'i18n:text' and all the attributes that are listed in 
> 'i18n:attr'
> > attribute. If you don't hurry then I'll send my stylesheet to you
> > tomorrow.
> >
> >>
> >> These two files, messages and dictionary, are the ones that
> >> make me not to
> >> understand the hole process.
> >
> > The process is this:
> >     - you create a content file and mark some parts of it 
> by 'i18n:text'
> > and 'i18n:attr'
> >     - run a stylesheet that generates you an empty dictionary file
> >     - you add your translations to that dictionary (say 
> message_de.xml)  -
> > place it in the message catalog (say in the 'translations'
> > directory)
> >     - enjoy
> >
> >>
> >> Could someone clarify those aspects or point me to a 
> better resource?
> >
> > I think that I'm the best resource to ask about i18n. Tell me if you
> > have any problems with it.
> >
> > Konstantin
> >
> >>
> >> Thanks in advance!
> >> --
> >> Albert Cervera Areny
> >> Dept. Informātica Sedifa, S.L.
> >>
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> Please check that your question  has not already been 
> answered in the
> >> FAQ before posting.     
> <http://xml.apache.org/cocoon/faq/index.html>
> >>
> >> To 
> unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> >> For additional commands, e-mail:   
> <[EMAIL PROTECTED]>
> >>
> >
> > 
> ---------------------------------------------------------------------
> > Please check that your question  has not already been 
> answered in the
> > FAQ before posting.     
> <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To 
> unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> > For additional commands, e-mail:   
> <[EMAIL PROTECTED]>
> 
> 
> -- 
> Albert Cervera Areny
> Dept. Informātica Sedifa, S.L.
> 
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
> 

Attachment: markup2messages.xsl
Description: Binary data

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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

Reply via email to