You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Urs Iwert <ur...@sysinf.ch> on 2005/10/05 11:05:08 UTC

AW: I18n transformer removes tags

Hello,

Yes, I'm using it for presentation, but I'm looking also for a solution
where I can have parts of the translated message be formatted in a
different way. The idea is more like RTF message. For this reason I must
be free to set tags wherever I want and it is not possible to have the
message be separated into smaller parts.

Once more. It must be possible to transfer a well formed message from a
message catalogue to my document.

Thanks for any help

Urs Iwert





Urs Iwert wrote:

>-- menu_en.xml -----------------------------------------
><catalogue xml:lang="en">
>  <message key="demo_reports"><b><i>Demo Reports</i></b></message>	
>  ...
><catalogue>
>--------------------------------------------------------
>
>1. Problem (major)
>The message "Demo Reports" should be translated into different
>languages. I also like to have the message formatted with some
>attributes like <b/>, <i/> or <u/> tags. I'm using the keyword for
>translation. I expected that the original message would be replaced by
>the language specific message. But the i18n transformer just removes
all
>tags.
>  
>
I think you shouldn't mix presentation <b/>, <i/> with your i18n
messages.

If you need to translate to an other language, you will need to 
copy/paste all those <b/>... in every language catalogue :-(

If you decide one or many of those messages must not be in bold anymore,

you will need to update all the catalogues :-( (once again)

A better way to achieve this is to use a css style:
<span class="my_bold_and_italic_style"><i18n/></span>

and put only the sentence in the i18n catalogue.

<message key="demo_reports">Demo Reports</message>

Regards,
--
Benjamin Francisoud

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



Hi there,

I'm using i18n transformer and I got two different problems. 
Below there are two files: menu source file and one of the translation
files.


-- menu.xml --------------------------------------------
<menu xmlns:i18n="http://apache.org/cocoon/i18n/2.1">

  <caption>
    <i18n:text i18n:key="demo_reports">
      Demo <b>Reports<b>
    </i18n:text>
  </caption>
  ...
</menu>
--------------------------------------------------------


-- menu_en.xml -----------------------------------------
<catalogue xml:lang="en">
  <message key="demo_reports"><b><i>Demo Reports</i></b></message>	
  ...
<catalogue>
--------------------------------------------------------


-- sitemap.xmap ----------------------------------------
<map:transformers default="xslt">
  <!-- Configure i18n transformer -->
  <map:transformer name="i18n" logger="sitemap.transformer.i18n"
src="org.apache.cocoon.transformation.I18nTransformer">
    <catalogues default="menu">
      <catalogue id="menu" name="menu" location="resources/languages"/>
    </catalogues>
    <untranslated-text>???</untranslated-text>
    <cache-at-startup>false</cache-at-startup>
  </map:transformer>
</map:transformers>
--------------------------------------------------------

1. Problem (major)
The message "Demo Reports" should be translated into different
languages. I also like to have the message formatted with some
attributes like <b/>, <i/> or <u/> tags. I'm using the keyword for
translation. I expected that the original message would be replaced by
the language specific message. But the i18n transformer just removes all
tags.

2. Problem (minor)
If there is no message catalogue available, the original text will be
shown with the tags applied in the original file, but all white spaces
before an after the tags are removed also ("DemoReports"). This Problem
is not really a problem, because I can have a translation for each tag.


Any help appreciated
Urs


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: AW: I18n transformer removes tags

Posted by Jason Johnston <co...@lojjic.net>.
Bertrand Delacretaz wrote:
> Le 5 oct. 05, à 11:05, Urs Iwert a écrit :
> 
>> ...Once more. It must be possible to transfer a well formed message 
>> from a
>> message catalogue to my document...
> 
> 
> The i18n transformer doesn't do that, you'll have to implement your own 
> stuff - if you aggregate your message catalog with your XML, merging the 
> two via XSLT shouldn't be hard.
> 

Hmm, are you sure?  IIUC Urs just wants i18n messages to be able to 
contain markup.  I've been using the i18n transformer like this for 
quite a while with success.

Urs, what version of Cocoon are we talking about here?  I've had this 
working successfully in 2.1.5.1 and 2.1.7.  The only difference I can 
see is that I use the message key as the child text of the i18n tag, 
rather than using @i18n:key, e.g. <i18n:text>demo_reports</i18n:text>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: AW: I18n transformer removes tags

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 5 oct. 05, à 11:05, Urs Iwert a écrit :

> ...Once more. It must be possible to transfer a well formed message 
> from a
> message catalogue to my document...

The i18n transformer doesn't do that, you'll have to implement your own 
stuff - if you aggregate your message catalog with your XML, merging 
the two via XSLT shouldn't be hard.

-Bertrand


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org