[jsword-devel] [JIRA] Created: (JS-193) Problem with apostrophe and parameter in same resource property

Martin Denham (JIRA) jira at crosswire.org
Wed May 25 12:02:54 MST 2011


Problem with apostrophe and parameter in same resource property
---------------------------------------------------------------

                 Key: JS-193
                 URL: http://www.crosswire.org/bugs/browse/JS-193
             Project: JSword
          Issue Type: Bug
          Components: i18n - Translation, o.c.common.util
    Affects Versions: 1.6.1
         Environment: All
            Reporter: Martin Denham
            Assignee: DM Smith
            Priority: Blocker


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 \"{0}\"", "99999");
   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\ {0} = Cr\u00E9ation d'index. Traitement {0}
Test:
    Locale.setDefault(Locale.FRENCH);
    String jobName = JSMsg.gettext("Creating index. Processing {0}", "ABC");
    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


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the jsword-devel mailing list