cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <KPiroum...@flagship.ru>
Subject I18nTransformer (with param substitution)
Date Fri, 11 May 2001 16:12:58 GMT
Hi!

I've implemented the param substitution in I18nTransformer. Now it is
possible to use it like this:
<i18n:translate>
    <i18n:text>This page was hit {0} times.{/i18n:text>
    <i18n:param><xsp:expr>count</xsp:expr></i18n:param>
</i18n:translate>
The source and samples are attached. I have also attached an XML Spy project
file  for convenience.

I am open for comments and suggestions. Next task will be dictionary
improvement to support include and import capabilities.

Btw, is there a good way of internationalizing dates and currencies (to use
different formatting)?
Example:
<i18n:translate>
    <i18n:text>Current date {0, date, 'dd/MM/yyy'}.{/i18n:text> <!-- this is
stored in the dictionary -->
    <i18n:param><xsp:expr>new Date()</xsp:expr></i18n:param>
</i18n:translate>

The problem is that MessageFormat class that I use for substitution gets an
array of Objects as argument, but I cannot get objects from XML - only
strings. Any ideas?

Best regards,

Konstantin Piroumian
Software engineer

Protek Flagship LLC
Phone: + 7 095 795 0520 (add. 1288)
Fax: + 7 095 795 0525
E-mail: kpiroumian@flagship.ru
http://www.protek.com



Mime
View raw message