You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Greg Ward <ge...@gmail.com> on 2006/12/19 00:20:08 UTC

Inconsistent handling of apostrophes in .properties files (3.0.3)

We have discovered that Tapestry 3.0.3 treats apostrophes differently
in .properties files
depending on whether you use getMessage() or format().  This
particularly affects apostrophe-heavy
languages like French.  In particular, if a message looks like this:

  username = Nom d'utilisateur

then getMessage("username") returns the expected string, but
format("username") returns
"Nom dutilisateur", which is clearly wrong.  Digging a bit, we learned
that apostrophes
are used to escape braces, and correct syntax for an apostrophe is to
double it.  OK, fine:
we can change the above to

  username = Nom d''utilisateur

so that format("username") works.  But that makes
getMessage("username") return the double
apostrophe -- argh!

For now we are using this rule:
  * if a message has {nnn} in it, double apostrophes
  * if not, don't
in order to avoid incorrect user messages.  But this is gross.  If we
have to double apostrophes
in .properties files, we should have to double them in *all* properties!

So... is this a bug in Tapestry 3?  Or are we just using .properties
files incorrectly here?
If it is considered a bug, I would be happy to cook up a patch.

        Greg

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


Re: Inconsistent handling of apostrophes in .properties files (3.0.3)

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Hi Greg.

This seems to be a Java API issue, as Sun mention in the bug report:
"Using the apostrophe-quote character as an escape mechanism
was a serious design mistake in MessageFormat"
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4862106

You could try creating a JIRA issue for this, as Tapestry may
be able to work around it, but it would likely affect only new
releases. Another 3.x release seems unlikely.

Cheers,
Nick.


Greg Ward wrote:
> We have discovered that Tapestry 3.0.3 treats apostrophes differently
> in .properties files
> depending on whether you use getMessage() or format().  This
> particularly affects apostrophe-heavy
> languages like French.  In particular, if a message looks like this:
> 
>  username = Nom d'utilisateur
> 
> then getMessage("username") returns the expected string, but
> format("username") returns
> "Nom dutilisateur", which is clearly wrong.  Digging a bit, we learned
> that apostrophes
> are used to escape braces, and correct syntax for an apostrophe is to
> double it.  OK, fine:
> we can change the above to
> 
>  username = Nom d''utilisateur
> 
> so that format("username") works.  But that makes
> getMessage("username") return the double
> apostrophe -- argh!
> 
> For now we are using this rule:
>  * if a message has {nnn} in it, double apostrophes
>  * if not, don't
> in order to avoid incorrect user messages.  But this is gross.  If we
> have to double apostrophes
> in .properties files, we should have to double them in *all* properties!
> 
> So... is this a bug in Tapestry 3?  Or are we just using .properties
> files incorrectly here?
> If it is considered a bug, I would be happy to cook up a patch.
> 
>        Greg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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