Bug 867421

Summary: [fr_FR] [localization] French: double apostrophe is displayed where a single apostrophe should be displayed
Product: Red Hat Enterprise Virtualization Manager Reporter: Einav Cohen <ecohen>
Component: ovirt-engine-webadmin-portalAssignee: Vojtech Szocs <vszocs>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: aalam, croe, dyasny, ecohen, iheim, lijli, qe-i18n-bugs, Rhev-m-bugs, sgrinber, vszocs, ykaul
Target Milestone: ---Keywords: Translation
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: ux
Fixed In Version: si23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 20:07:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Screen-Shot of New VM dialog in French locale
none
FIXED Screenshot none

Description Einav Cohen 2012-10-17 13:30:43 UTC
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:

Comment 1 Einav Cohen 2012-10-17 13:32:17 UTC
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.

Comment 3 Einav Cohen 2012-10-22 00:58:48 UTC
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.

Comment 4 Vojtech Szocs 2012-10-22 10:54:28 UTC
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

Comment 5 Vojtech Szocs 2012-10-22 14:40:11 UTC
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)

Comment 6 Vojtech Szocs 2012-10-22 15:57:54 UTC
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.

Comment 7 Vojtech Szocs 2012-10-22 16:45:47 UTC
u/s patch: http://gerrit.ovirt.org/#/c/8730/

Comment 8 Einav Cohen 2012-10-23 09:39:45 UTC
d/s patch: https://gerrit.eng.lab.tlv.redhat.com/#/c/2809/

Comment 9 Einav Cohen 2012-10-23 15:27:47 UTC
(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.

Comment 10 Itamar Heim 2012-10-25 05:07:00 UTC
*** Bug 869845 has been marked as a duplicate of this bug. ***

Comment 11 A S Alam 2012-11-12 02:59:49 UTC
Created attachment 643168 [details]
FIXED Screenshot

tested version: rhevm-3.1.0-26.el6ev.noarch
Language: fr_FR
status: FIXED