Details
-
Type: Bug
-
Status: Closed (View Workflow)
-
Priority: Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.6.1
-
Fix Version/s: 1.6.1
-
Component/s: i18n - Translation, o.c.common.util
-
Labels:
-
Environment:
All
Description
There is an issue if a resource string contains an apostrophe and is processed by MessageFormat to replace parameters.
Here is an example
String errorMsg = JSMsg.gettext("Not a valid Strong's Number \"
System.out.println(errorMsg);
Prints:
Not a valid Strongs Number "{0}
"
It seems that the apostrophe is quoting the rest of the string and therefore the apostrophe is removed and the parameter substitution prevented.
I first noticed this in JSMsg_fr.properties because French has a lot of apostrophes e.g.
Creating\ index.\ Processing\
Test:
Locale.setDefault(Locale.FRENCH);
String jobName = JSMsg.gettext("Creating index. Processing
System.out.println(jobName);
Prints
Création dindex. Traitement {0}
There seem to be 2 approaches to solve this:
1. double all apostrophes in all properties files manually
2. double all apostrophes before calling MessageFormat in MsgBase as in the second (IBM) link below
I think option 2 is less work and possibly better.
This issue is discussed in the following pages:
http://blogs.oracle.com/byuan/entry/best_practices_of_handling_apostrophes
http://publib.boulder.ibm.com/infocenter/wchelp/v5r6m1/index.jsp?topic=/com.ibm.commerce.developer.doc/refs/rgbtips.htm