You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Enke Michael <Mi...@wincor-nixdorf.com> on 2001/08/07 14:44:52 UTC

I18nTransformer patch

Hi,
I have added some lines of code to I18nTransformer.java
and tested. It is attached to this mail.
I hope this is useful not only to me ;-)

1) before: <i18n:date ... />   -> date and time
   now: <i18n:date ... />      -> only date -> incompatibility
                 -> new URI: http://apache.org/cocoon/i18n/2.1
        <i18n:time ... />      -> time
        <i18n:date-time ... /> -> date and time
2) the src-pattern and pattern attributes for date and time
   recognizes now also:"short", "medium", "long" and "full"
   in addition to a regular pattern
3) fixed a bug in <i18n:number/> wich caused wrong output if the
   value was given as text and not as value="...":
   <i18n:number sub-type="currency">
    123.45
   </i18n:number>
4) for number and date/time: introduced the attributes 'locale'
   and 'src-locale', e.g.:
   <i18n:date src-pattern="short" src-locale="en_US" locale="de_DE">
    12/24/01
   </i18n:date>
   will result in 24.12.2001
   A given "real" pattern and src-pattern (not short, medium, long,
full)
   overwrites the locale and src-locale

I send a diff -u <old> <new> where <new> is:
a) -> src/org/apache/cocoon/transformation/I18nTransformer.java
b) -> xdocs/i18n-transformer.xml

Does anybody have suggestions/remarks?

Best regards,
Michael


Re: I18nTransformer patch

Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
> Here are my answers:
>
> "Piroumian, Konstantin" wrote:
> > ...
> > Why only in number and date/time? I think that 'locale' attribute can be
> > useful also in all other tags, such as i18n:text, i18n:param, etc. If
you
> > are using a locale stack (as I proposed in one of my emails) then it
will be
> > very easy to add this, isn't it?
> > I would do it myself, but unfortunately I am very busy at my paid work
and
> > even have no possibility to checkout the CVS snapshot. :(((
>
> I used alternative variables for Locale: loc and srcLoc,
> which will be initialised to the locale from the attributes or if no
> locale-attribute to the default locale from setup().
> I had a close look for the other elements but on the fly I didn't find
> where to insert it for i18n:text and i18n:param. And I'm also busy at my
> paid work ;-(
> So for date and time it was essentially for me but the other ... may be
> later.

Sure, it's open source and if somebody will really need it then he can add
that himself. I'll try to look at it during this weekend.

> > The original document was xdocs/i18n.xml. I noticed there they are the
same
> > with i18n-transformer.xml. Is there a good reason for having to sets of
> > identical documents?
>
> I got xdocs/i18n-transformer.xml via the web interface because I have no
> access
> to cvs directly (firewall!? after typing in the password: Connection
> timed out)
> And there is no xdocs/i18n.xml if you are looking to the web interface.

I must have had a rather old snapshot of Cocoon CVS. Many things have
changed since my last update.

>
> > Btw, the common procedure is to send a 'diff' from the CVS root
directory.
> > In this case, you'd have one file instead of two. And also it's  easier
to
> > apply the patch.
>
> As I said, I have no access to cvs, only to through the web interface.

Ok. Hope it's not a problem for committers to apply two patches.

Btw, it's seems that there is no much interest in i18n with Cocoon. It would
be interesting to hear more comments and suggestions. Also, it's interesting
to see how the transformer behaves under a heavy load.

> Regards,
> Michael

Konstantin.


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


Re: I18nTransformer patch

Posted by Enke Michael <Mi...@wincor-nixdorf.com>.
Here are my answers:

"Piroumian, Konstantin" wrote:
> ...
> Why only in number and date/time? I think that 'locale' attribute can be
> useful also in all other tags, such as i18n:text, i18n:param, etc. If you
> are using a locale stack (as I proposed in one of my emails) then it will be
> very easy to add this, isn't it?
> I would do it myself, but unfortunately I am very busy at my paid work and
> even have no possibility to checkout the CVS snapshot. :(((

I used alternative variables for Locale: loc and srcLoc,
which will be initialised to the locale from the attributes or if no
locale-attribute to the default locale from setup().
I had a close look for the other elements but on the fly I didn't find
where to insert it for i18n:text and i18n:param. And I'm also busy at my
paid work ;-(
So for date and time it was essentially for me but the other ... may be
later.


> The original document was xdocs/i18n.xml. I noticed there they are the same
> with i18n-transformer.xml. Is there a good reason for having to sets of
> identical documents?

I got xdocs/i18n-transformer.xml via the web interface because I have no
access
to cvs directly (firewall!? after typing in the password: Connection
timed out)
And there is no xdocs/i18n.xml if you are looking to the web interface.

> Btw, the common procedure is to send a 'diff' from the CVS root directory.
> In this case, you'd have one file instead of two. And also it's  easier to
> apply the patch.

As I said, I have no access to cvs, only to through the web interface.


Regards,
Michael

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


Re: I18nTransformer patch

Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
Fine!

I like your changes.
I'd like to add a fiew comments:

> Hi,
> I have added some lines of code to I18nTransformer.java
> and tested. It is attached to this mail.
> I hope this is useful not only to me ;-)
>
> 1) before: <i18n:date ... />   -> date and time
>    now: <i18n:date ... />      -> only date -> incompatibility
>                  -> new URI: http://apache.org/cocoon/i18n/2.1
>         <i18n:time ... />      -> time
>         <i18n:date-time ... /> -> date and time
> 2) the src-pattern and pattern attributes for date and time
>    recognizes now also:"short", "medium", "long" and "full"
>    in addition to a regular pattern
> 3) fixed a bug in <i18n:number/> wich caused wrong output if the
>    value was given as text and not as value="...":
>    <i18n:number sub-type="currency">
>     123.45
>    </i18n:number>
> 4) for number and date/time: introduced the attributes 'locale'
>    and 'src-locale', e.g.:

Why only in number and date/time? I think that 'locale' attribute can be
useful also in all other tags, such as i18n:text, i18n:param, etc. If you
are using a locale stack (as I proposed in one of my emails) then it will be
very easy to add this, isn't it?
I would do it myself, but unfortunately I am very busy at my paid work and
even have no possibility to checkout the CVS snapshot. :(((

>    <i18n:date src-pattern="short" src-locale="en_US" locale="de_DE">
>     12/24/01
>    </i18n:date>
>    will result in 24.12.2001
>    A given "real" pattern and src-pattern (not short, medium, long,
> full)
>    overwrites the locale and src-locale
>
> I send a diff -u <old> <new> where <new> is:
> a) -> src/org/apache/cocoon/transformation/I18nTransformer.java
> b) -> xdocs/i18n-transformer.xml

The original document was xdocs/i18n.xml. I noticed there they are the same
with i18n-transformer.xml. Is there a good reason for having to sets of
identical documents?

>
> Does anybody have suggestions/remarks?

Not yet ;)

Btw, the common procedure is to send a 'diff' from the CVS root directory.
In this case, you'd have one file instead of two. And also it's  easier to
apply the patch.

>
> Best regards,
> Michael
>

Regards,
    Konstantin Piroumian.

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