Qingjiang Yuan

pageicon Tuesday May 29, 2007

Best practices of handling apostrophes ( ’) in .properties files

Problem: java.text.MessageFormat requires single ( ’) be escaped using double  ( ’’), other classes
don't have this requirement.

 

Best practices:

  • Double the apostrophe (’’) when you see bracket(s) ({}) in the same message.
  • Do not double the apostrophe( ’) if there is no bracket ({}) in the same message.
  • Do not double the apostrophe( ’) if you see an apostrophe in the original English contents since it should have been confirmed to be displayed properly.
  • Do not use apostrophe( ’), use quotation mark (′) instead.



Comments:

Hi Brian, A few comments/questions: - Does this mean that translators have to always remember to look for curly brackets in the strings and double their quotes accordingly? I think that this is very error-prone and it also pollutes the translation memories. (Suppose you have a string that had a {0} variable and another one that is identical or similar but does not have any {0}-s. If you translate the first and save the segment to the TM, you would not be able to reuse your existing translation without some editing when translating the second string, because it contains doubled apostrophes.) - What if a developer passes a string to java.text.MessageFormat that does not contain any {0} variables? It is an unlikely scenario, but it can not be ruled out and in this case the translator is helpless, because he/she would have no knowledge about the string being passed to MessageFormat and therefore would not double his/her apostrophes. - What's the difference between the apostrophe and the single quote characters? Can you specify their Unicode value, just to rule out any confusion?

Posted by Peter Mork on May 29, 2007 at 10:05 AM PDT #

Hi, Peter, I understand your concerns about reusing the translations and also the difficulties of checking the {0}, one possible solution is to write a simple script to do post-editing after finalizing the translation. To avoid the senario of using java.text.MessageFormat when there is no {0} variables, we can ask the developers and translators to always use the single quote character (\u2032) instead of the apostrophe (\u2019). Thanks, Brian

Posted by 192.18.101.5 on May 29, 2007 at 10:27 AM PDT #

Also thanks Peter for the following related URL: http://publib.boulder.ibm.com/infocenter/wchelp/v5r6m1/index.jsp?topic=/com.ibm.commerce.developer.doc/refs/rgbtips.htm

Posted by 192.18.101.5 on May 29, 2007 at 10:29 AM PDT #

o

Posted by 193.78.170.197 on July 08, 2009 at 10:39 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today

Feeds

Search this blog

Links

Weblog menu

Today's referrers

Today's Page Hits: 319