You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk> on 2004/04/19 14:13:56 UTC

AbstractComponent.format() returns uppercased pattern

I'm trying to utilize the localisation support provided by
the Tapestry framework, but something goes wrong. When I do

    String pattern = "foo = {0}, bar = {1}";
    writer.print(format(pattern, "foo", "bar"));

in the renderComponent() method of a component subclassing
AbstractComponent, where writer is an IMarkupWriter, I get

    [FOO = foo, BAR = bar]

and not

    foo = foo, bar = bar

as I would expect. It seems that whenever I use placeholders in the
pattern, the pattern text is uppercased, but the parameters are not.

My guess is that something intervenes the format process and uppercases
my pattern. But I don't know what... Just to be thorough, I made a small
test-program and tested the MessageFormat (from java.text) to make sure
that this wasn't the source. And the test went fine. So now I'm confused.

My questions are: Have any of you experienced similar behaviour? And do any
of you know how to solve it? In that case, I'd love to hear from you!

BTW, I'm running J2SDK SE v1.4.2_04 on Windows XP Professional, using Apache
Tomcat/5.0.19 and Tapestry 3.0. Thanks in advance.

-Filip S. Adamsen


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: AbstractComponent.format() returns uppercased pattern

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
String msg = format("foobar", "foo", "bar");
writer.print(msg);

..or...

writer.print(format("foobar", "foo", "bar"));


...or...

writer.print(getMessages().format("foobar", "foo", "bar"));

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components 
Creator, HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: Filip S. Adamsen [mailto:filip@stubkjaer-adamsen.dk] 
> Sent: Monday, April 19, 2004 8:32 AM
> To: 'Tapestry users'
> Subject: RE: AbstractComponent.format() returns uppercased pattern
> 
> 
> That is exactly what I do, I just tried to simplify the 
> example. Anyhow, I
> still get the same output when I do:
> 
>     String msg = getMessage("foobar");
>     writer.print(format(msg, "foo", "bar"));
> 
> But if I use MessageFormat directly, everything's fine. So 
> what could be
> wrong? Could it be something in the framework?
> 
> -Filip S. Adamsen
> 
> -----Original Message-----
> From: Howard M. Lewis Ship [mailto:hlship@comcast.net] 
> Sent: Monday, April 19, 2004 2:22 PM
> To: 'Tapestry users'
> Subject: RE: AbstractComponent.format() returns uppercased pattern
> 
> The pattern is indirect; you provide a key and Tapestry looks 
> it up in the
> component's messages.
> 
> If its not found, the key is converted to upper case to make 
> it obvious that
> your code and your
> messages don't match, but to allow the application to continue.
> 
> If, for some reason, you can't store your message pattern in your
> component's messages file, then
> use MessageFormat directly.
> 
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Tapestry: Java Web Components 
> Creator, HiveMind
> http://howardlewisship.com
> 
> 
> > -----Original Message-----
> > From: Filip S. Adamsen [mailto:filip@stubkjaer-adamsen.dk] 
> > Sent: Monday, April 19, 2004 8:14 AM
> > To: tapestry-user@jakarta.apache.org
> > Subject: AbstractComponent.format() returns uppercased pattern
> > 
> > 
> > I'm trying to utilize the localisation support provided by
> > the Tapestry framework, but something goes wrong. When I do
> > 
> >     String pattern = "foo = {0}, bar = {1}";
> >     writer.print(format(pattern, "foo", "bar"));
> > 
> > in the renderComponent() method of a component subclassing
> > AbstractComponent, where writer is an IMarkupWriter, I get
> > 
> >     [FOO = foo, BAR = bar]
> > 
> > and not
> > 
> >     foo = foo, bar = bar
> > 
> > as I would expect. It seems that whenever I use placeholders in the
> > pattern, the pattern text is uppercased, but the parameters are not.
> > 
> > My guess is that something intervenes the format process and 
> > uppercases
> > my pattern. But I don't know what... Just to be thorough, I 
> > made a small
> > test-program and tested the MessageFormat (from java.text) to 
> > make sure
> > that this wasn't the source. And the test went fine. So now 
> > I'm confused.
> > 
> > My questions are: Have any of you experienced similar 
> > behaviour? And do any
> > of you know how to solve it? In that case, I'd love to hear 
> from you!
> > 
> > BTW, I'm running J2SDK SE v1.4.2_04 on Windows XP 
> > Professional, using Apache
> > Tomcat/5.0.19 and Tapestry 3.0. Thanks in advance.
> > 
> > -Filip S. Adamsen
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: AbstractComponent.format() returns uppercased pattern

Posted by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>.
That is exactly what I do, I just tried to simplify the example. Anyhow, I
still get the same output when I do:

    String msg = getMessage("foobar");
    writer.print(format(msg, "foo", "bar"));

But if I use MessageFormat directly, everything's fine. So what could be
wrong? Could it be something in the framework?

-Filip S. Adamsen

-----Original Message-----
From: Howard M. Lewis Ship [mailto:hlship@comcast.net] 
Sent: Monday, April 19, 2004 2:22 PM
To: 'Tapestry users'
Subject: RE: AbstractComponent.format() returns uppercased pattern

The pattern is indirect; you provide a key and Tapestry looks it up in the
component's messages.

If its not found, the key is converted to upper case to make it obvious that
your code and your
messages don't match, but to allow the application to continue.

If, for some reason, you can't store your message pattern in your
component's messages file, then
use MessageFormat directly.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components 
Creator, HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: Filip S. Adamsen [mailto:filip@stubkjaer-adamsen.dk] 
> Sent: Monday, April 19, 2004 8:14 AM
> To: tapestry-user@jakarta.apache.org
> Subject: AbstractComponent.format() returns uppercased pattern
> 
> 
> I'm trying to utilize the localisation support provided by
> the Tapestry framework, but something goes wrong. When I do
> 
>     String pattern = "foo = {0}, bar = {1}";
>     writer.print(format(pattern, "foo", "bar"));
> 
> in the renderComponent() method of a component subclassing
> AbstractComponent, where writer is an IMarkupWriter, I get
> 
>     [FOO = foo, BAR = bar]
> 
> and not
> 
>     foo = foo, bar = bar
> 
> as I would expect. It seems that whenever I use placeholders in the
> pattern, the pattern text is uppercased, but the parameters are not.
> 
> My guess is that something intervenes the format process and 
> uppercases
> my pattern. But I don't know what... Just to be thorough, I 
> made a small
> test-program and tested the MessageFormat (from java.text) to 
> make sure
> that this wasn't the source. And the test went fine. So now 
> I'm confused.
> 
> My questions are: Have any of you experienced similar 
> behaviour? And do any
> of you know how to solve it? In that case, I'd love to hear from you!
> 
> BTW, I'm running J2SDK SE v1.4.2_04 on Windows XP 
> Professional, using Apache
> Tomcat/5.0.19 and Tapestry 3.0. Thanks in advance.
> 
> -Filip S. Adamsen
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: AbstractComponent.format() returns uppercased pattern

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
The pattern is indirect; you provide a key and Tapestry looks it up in the component's messages.

If its not found, the key is converted to upper case to make it obvious that your code and your
messages don't match, but to allow the application to continue.

If, for some reason, you can't store your message pattern in your component's messages file, then
use MessageFormat directly.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components 
Creator, HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: Filip S. Adamsen [mailto:filip@stubkjaer-adamsen.dk] 
> Sent: Monday, April 19, 2004 8:14 AM
> To: tapestry-user@jakarta.apache.org
> Subject: AbstractComponent.format() returns uppercased pattern
> 
> 
> I'm trying to utilize the localisation support provided by
> the Tapestry framework, but something goes wrong. When I do
> 
>     String pattern = "foo = {0}, bar = {1}";
>     writer.print(format(pattern, "foo", "bar"));
> 
> in the renderComponent() method of a component subclassing
> AbstractComponent, where writer is an IMarkupWriter, I get
> 
>     [FOO = foo, BAR = bar]
> 
> and not
> 
>     foo = foo, bar = bar
> 
> as I would expect. It seems that whenever I use placeholders in the
> pattern, the pattern text is uppercased, but the parameters are not.
> 
> My guess is that something intervenes the format process and 
> uppercases
> my pattern. But I don't know what... Just to be thorough, I 
> made a small
> test-program and tested the MessageFormat (from java.text) to 
> make sure
> that this wasn't the source. And the test went fine. So now 
> I'm confused.
> 
> My questions are: Have any of you experienced similar 
> behaviour? And do any
> of you know how to solve it? In that case, I'd love to hear from you!
> 
> BTW, I'm running J2SDK SE v1.4.2_04 on Windows XP 
> Professional, using Apache
> Tomcat/5.0.19 and Tapestry 3.0. Thanks in advance.
> 
> -Filip S. Adamsen
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org