You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Juan Jose Pablos <ch...@che-che.com> on 2003/09/04 02:23:53 UTC

Re: Multi-lingual static web site

Raymond,

Sorry If this too to long to reply.

raymond@dotsphinx.com wrote:
> 
> I have searched the mailinglist archives and found some references to
> the Cocoon i18n translator. What I couldn't find was how to integrate
> this with a clean out-of-the-box Forrest installation?

I18n is to translate a <itext>Translate this</itext> within a xml 
document. It would be added possibly after 0.5 release, but I think that 
is not what are you looking for.

> 
> Does anybody have a ready-to-go example? 

I have not got any example of how to achive a multi-lingual site, but 
maybe I will write down something tomorrow if I got some time.


Cheers,
CheChe


i18n default locale

Posted by Corneanu Dan <cd...@savatech.ro>.
Hi there!

Is there any way to tell i18n what locale to use as default if no 
'locale' parameter was specified in a
<map:transform type="i18n"> .... </map:transform> ?

My problems is that if my site is rendered on a machine with a DE locale 
I get the default pages translated to DE not
to EN as done on my machine.

Best regards,
Dan.


Re: Multi-lingual static web site

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Raymond Penners" <ra...@dotsphinx.com>
> Konstantin Piroumian wrote:
>
...
>
> Thanks, that seems to work.  Now I am wondering where to place the
> messages.properties files containing the translations. The i18n
> transformer is configured as follows:

First of all, the file should be 'messages.xml', otherwise it won't work.

>
>          <map:transformer name="i18n"
> src="org.apache.cocoon.transformation.I18nTransformer">
>               <catalogue-name>messages</catalogue-name>
>               <catalogue-location>translations</catalogue-location>
>               <untranslated-text>untranslated</untranslated-text>
>               <cache-at-startup>true</cache-at-startup>
>          </map:transformer>

AFAIR, paths are treated relatively to the sitemap location where you have
added this component. You can try to use an absolute path for
<catalogue-location>, e.g. /translations - this will be resolved to the
context root (have no idea where is it in case of CLI, for webapps it's the
web application directory).

>
> So, I tried placing a "messages.properties" file in
> "src/documentation/resources/translations/messages.properties". But
> forrest complains: "Unable to locate resource: messages".

Hm, not a very informative message, I should definitely find time to fix it.
Try to put it somewhere in: src/resources/conf/translations

For more on i18n see the documentation of i18n transformer and even better
to take a look at the samples in Cocoon 2.1.

Regards,
  Konstantin

>
> Thanks again,
>
> -- 
> Raymond Penners -*- raymond@dotsphinx.com -*- www.dotsphinx.com
>
>
>


Re: Multi-lingual static web site

Posted by Raymond Penners <ra...@dotsphinx.com>.
Konstantin Piroumian wrote:

>This is just the validation of your document that fails. You can simply turn
>it off somewhere in properties (or just modify the build file and remove the
>validate-xdocs target temporarily).
>
>More correct option fix to this is to extend the according DTD to allow
>i18n:* elements (or what is used for tabs validation).
>  
>

Thanks, that seems to work.  Now I am wondering where to place the 
messages.properties files containing the translations. The i18n 
transformer is configured as follows:

         <map:transformer name="i18n" 
src="org.apache.cocoon.transformation.I18nTransformer">
              <catalogue-name>messages</catalogue-name>
              <catalogue-location>translations</catalogue-location>
              <untranslated-text>untranslated</untranslated-text>
              <cache-at-startup>true</cache-at-startup>
         </map:transformer>

So, I tried placing a "messages.properties" file in 
"src/documentation/resources/translations/messages.properties". But 
forrest complains: "Unable to locate resource: messages".

Thanks again,

-- 
Raymond Penners -*- raymond@dotsphinx.com -*- www.dotsphinx.com



Re: Multi-lingual static web site

Posted by Raymond Penners <ra...@dotsphinx.com>.
Konstantin Piroumian wrote:

>This is just the validation of your document that fails. You can simply turn
>it off somewhere in properties (or just modify the build file and remove the
>validate-xdocs target temporarily).
>
>More correct option fix to this is to extend the according DTD to allow
>i18n:* elements (or what is used for tabs validation).
>  
>

Thanks, that seems to work.  Now I am wondering where to place the 
messages.properties files containing the translations. The i18n 
transformer is configured as follows:

         <map:transformer name="i18n" 
src="org.apache.cocoon.transformation.I18nTransformer">
              <catalogue-name>messages</catalogue-name>
              <catalogue-location>translations</catalogue-location>
              <untranslated-text>untranslated</untranslated-text>
              <cache-at-startup>true</cache-at-startup>
         </map:transformer>

So, I tried placing a "messages.properties" file in 
"src/documentation/resources/translations/messages.properties". But 
forrest complains: "Unable to locate resource: messages".

Thanks again,

-- 
Raymond Penners -*- raymond@dotsphinx.com -*- www.dotsphinx.com



Re: Multi-lingual static web site

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Raymond Penners" <ra...@dotsphinx.com>
> Konstantin Piroumian wrote:
>
> >Yes, i18n transformer is fine for menus, titles, navbars, etc., but not
for
> >documents. Though, it's possible to use it for document translation, e.g.
by
> >paragraph:
> ><p><i18n:text key="first_para"/></p>.
> >
> >Just ask if you need more details on how to use it.
> >
> >
> I have tried to extend the Forrest tabs.xml with the xmlns:i18n
> namespace and used an i18n:text, like this:
>
> <tabs software="MyProj"
>   title="MyProj"
>   copyright="Foo"
>   xmlns:xlink="http://www.w3.org/1999/xlink"
>   xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
>  ...
>   <tab label="Home" i18n:attr="label" dir=""/>
>
> Still, the build fails:
>
> validate-xdocs:
> /home/workrave/public_html/src/documentation/content/xdocs/tabs.xml:9:4:
> Attrib\
> ute "xmlns:i18n" must be declared for element type "tabs".
> /home/workrave/public_html/src/documentation/content/xdocs/tabs.xml:18:47:
> Attr\
> ibute "i18n:attr" must be declared for element type "tab".

This is just the validation of your document that fails. You can simply turn
it off somewhere in properties (or just modify the build file and remove the
validate-xdocs target temporarily).

More correct option fix to this is to extend the according DTD to allow
i18n:* elements (or what is used for tabs validation).

>
>
> Do you perhaps have any idea?
>
> I am not really sure where I should place "<map:transform type="i18n">".
> My guess would be here, in sitemap.xmap:
>
> <!-- Pipeline that manages the internal URI space
>        For the external URI space manager, see the next pipeline.
>        Set it to internal-only="true" in production environment -->
>       <map:pipeline internal-only="false">
>          <map:match pattern="**tab-**.xml">
>             <map:generate src="content/xdocs/tabs.xml" />
> -->
> -->            <map:transform type="i18n">
> -->                <map:parameter name="locale" value="en"/>
> -->            </map:transform>
>
>             <map:transform type="linkrewriter" src="cocoon:/linkmap" />

Seems to be the correct place.

I am CC-ing the message to forrest-dev so more people could help with this.

Regards,
  Konstantin

>
>
> Thanks,
> --
> Raymond Penners -*- raymond@dotsphinx.com -*- www.dotsphinx.com
>
>


Re: Multi-lingual static web site

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Raymond Penners" <ra...@dotsphinx.com>
> Juan Jose Pablos wrote:
>
> >> I have searched the mailinglist archives and found some references to
> >> the Cocoon i18n translator. What I couldn't find was how to integrate
> >> this with a clean out-of-the-box Forrest installation?
> >
> >
> > I18n is to translate a <itext>Translate this</itext> within a xml
> > document. It would be added possibly after 0.5 release, but I think
> > that is not what are you looking for.
>
>
> The i18n translator approach to translate bits of text from XML
> documents would suffice for now. I understand that there are other
> options, like translating documents as a a whole.

Yes, i18n transformer is fine for menus, titles, navbars, etc., but not for
documents. Though, it's possible to use it for document translation, e.g. by
paragraph:
<p><i18n:text key="first_para"/></p>.

Just ask if you need more details on how to use it.

>
> Still, is the i18n translator approach something that  can already be
> made to work with the current version of Forrest, e.g. by tweaking some
> XML files. Or, is this future functionality?
>
> I have tried using some i18n tags but that did not seem to work. I am
> also wondering how Forrest would be able to generate a static site using
> this approach. For example, how does it know that it has to generate
> document.en.html and document.nl.html, given document.xml ?

You should modify the pipelines that generate contents for menus and add
something like:
<map:transform type="i18n">
  <map:parameter name="locale" value="{??}" />
</map:transform>

you should specify the locale to use. For that you can use URLs like
/en/index.html and modify the matcher to extract the locale part and pass it
to the i18n trasformer. Not sure if it's possible to use request parameters
for static site generation.

Also, you should make sure that i18n transformer component is defined.

Seems that this requires quite good knowledge of Cocoon.

-- Konstantin

>
> Thanks,
>
> -- 
> Raymond Penners -*- raymond@dotsphinx.com -*- www.dotsphinx.com
>
>
>


Re: Multi-lingual static web site

Posted by Raymond Penners <ra...@dotsphinx.com>.
Juan Jose Pablos wrote:

>> I have searched the mailinglist archives and found some references to
>> the Cocoon i18n translator. What I couldn't find was how to integrate
>> this with a clean out-of-the-box Forrest installation?
>
>
> I18n is to translate a <itext>Translate this</itext> within a xml 
> document. It would be added possibly after 0.5 release, but I think 
> that is not what are you looking for.


The i18n translator approach to translate bits of text from XML 
documents would suffice for now. I understand that there are other 
options, like translating documents as a a whole.

Still, is the i18n translator approach something that  can already be 
made to work with the current version of Forrest, e.g. by tweaking some 
XML files. Or, is this future functionality?

I have tried using some i18n tags but that did not seem to work. I am 
also wondering how Forrest would be able to generate a static site using 
this approach. For example, how does it know that it has to generate 
document.en.html and document.nl.html, given document.xml ?

Thanks,

-- 
Raymond Penners -*- raymond@dotsphinx.com -*- www.dotsphinx.com