Description of problem: There are several places in the application in which double apostrophe appears in a text instead of a single apostrophe. happens a lot in the French locale. Version-Release number of selected component (if applicable): si21 How reproducible: always Steps to Reproduce: In French locale: 1. Open "New Desktop / New Server" dialog, look at the "OS Type" field, or: 2. Open "Setup Host Networks" dialog, look at the "Verify connectivity between Host and Engine" check-box label, or: 3. ... Actual results: Text appears with double apostrophe ('') Expected results: Text should appear with a single apostrophe ('). Additional info:
Created attachment 628812 [details] Screen-Shot of New VM dialog in French locale screen shot is taken from oVirt - behavior is the same in rhev-m si21.
may be related: http://code.google.com/p/google-web-toolkit/issues/detail?id=6647 http://stackoverflow.com/questions/6537716/how-to-handle-single-quotes-in-internationalization-constants
additional clarifications: - if some of the strings (within the .properties files) will be changed to contain a single apostrophe, a gwt compilation failure will occur (see http://stackoverflow.com/questions/6537716/how-to-handle-single-quotes-in-internationalization-constants) - there are some strings (within the .properties files) that contain double apostrophe, however the text is eventally displayed in the GUI appropriately (i.e. only with a single apostrophe). Of course, some of the strings are displayed eventually with double apostrophe (this is what this bug is about) - not sure why for some strings it is OK and for others it isn't; according to this: http://code.google.com/p/google-web-toolkit/issues/detail?id=6647 - the issue is Constants vs. Messages.
Einav, many thanks for posting related references. Apparently, translator system in use (Zanata) adheres to Java MessageFormat specification: http://docs.oracle.com/javase/6/docs/api/java/text/MessageFormat.html Java MessageFormat treats double quotes ('') as single quote. Java MessageFormat documentation says: > Within a String, "''" represents a single quote. In GWT, there are two different types of localization resources (key/value mappings): 1. Constants - values are constants (no arguments), *does not* adhere to Java MessageFormat specification 2. Messages - values can contain arguments, *does* adhere to Java MessageFormat specification WebAdmin and UserPortal use *both* types of localization resources. Possible solutions: 1. (less feasible IMHO) translators will use single quotes in Constants-related properties files 2. (more feasible IMHO) replace Constants with Messages for both applications, given that properties file names will stay unchanged
Oh well, the situation is a bit more complicated since we're also using Constants sub-interface ConstantsWithLookup, which provides the ability to retrieve values by keys programatically (instead of referencing values through keys directly in code). And there's no "MessagesWithLookup" in GWT, unfortunately. Two approaches possible: 1. modify Constants-related properties files [replace '' -> '], instruct translator team to use single quotes in Constants-related properties files, write checkstyle build-time checker that warns if double quotes is used in given Constants-related properties file 2. Extend GWT Constants/ConstantsWithLookup deferred binding generator, which takes care of replacing '' -> ' behind the scenes (no application code adapter classes necessary)
For now, we can replace '' -> ' in all Constants-related properties files. In future, we should allow translator team to use single quotes in all properties files. This includes Messages-related properties files, which adhere to Java MessageFormat specification. In frontend/webadmin/modules/gwt-extension, we can add an aspect (class annotated with @Aspect) that replaces ' -> '' for Messages-related values: a, in com.google.gwt.i18n.rebind.MessageFormatParser class: public static List<TemplateChunk> parse(String template) throws ParseException b, in com.google.gwt.i18n.server.MessageFormatUtils.MessageStyle.MESSAGE_FORMAT enum: public List<TemplateChunk> parse(String template) throws ParseException The above two are the only places from which "Unterminated single quote" exception can originate. The aspect would modify "template" parameter, doing ' -> '' replacement.
u/s patch: http://gerrit.ovirt.org/#/c/8730/
d/s patch: https://gerrit.eng.lab.tlv.redhat.com/#/c/2809/
(In reply to comment #6) > In future, we should allow translator team to use single quotes in all > properties files. This includes Messages-related properties files, which > adhere to Java MessageFormat specification. opened bug 869329 to track this issue.
*** Bug 869845 has been marked as a duplicate of this bug. ***
Created attachment 643168 [details] FIXED Screenshot tested version: rhevm-3.1.0-26.el6ev.noarch Language: fr_FR status: FIXED