cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: i18n Translations to String
Date Thu, 16 Nov 2006 16:55:15 GMT
Jeremy Quinn wrote:
> Hi All
> 
> I am close to finishing an UploadProgressBar Dojo Widget for CForms and 
> am trying to implement i18n status messages.
> 
> I have a FlowScript that reads the upload status and sends this as JSON 
> to the UploadProgressBar.
> I was trying to avoid using JXTemplate for the serialization, instead, I 
> serialize the data (a Map) to JSON in FlowScript and send it using :
> 
>     <map:match pattern="send-json">
>        <map:read src="module:flow-attr:json" mime-type="text/javascript" />
>     </map:match>
> 
> I was hoping to do i18n lookup in FlowScript using 
> o.a.c.forms.util.I18nMessage but of course it outputs SAX events, not 
> Strings :(
> 
> I will either have to switch to using JXT for serialization, or find an 
> alternative i18n lookup mechanism.
> 
> Any suggestions anyone ?

I18nMessage does not do lookups: I18nTransformer does.

Now if you want to play I18nTransformer in Flow, you need to lookup catalogue 
from XMLResourceBundleFactory, and then you can translate the key into String 
using XMLResourceBundle.getString(key) method. You'll lose any HTML markup which 
was in the translation, you'll get only message text.

Vadim

Mime
View raw message