This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 867421 - [fr_FR] [localization] French: double apostrophe is displayed where a single apostrophe should be displayed
[fr_FR] [localization] French: double apostrophe is displayed where a single ...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-webadmin-portal (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: vszocs
ux
: Translation
: 869845 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-17 09:30 EDT by Einav Cohen
Modified: 2012-12-04 15:07 EST (History)
11 users (show)

See Also:
Fixed In Version: si23
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-04 15:07:49 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Screen-Shot of New VM dialog in French locale (33.64 KB, image/png)
2012-10-17 09:32 EDT, Einav Cohen
no flags Details
FIXED Screenshot (65.59 KB, image/png)
2012-11-11 21:59 EST, A S Alam
no flags Details

  None (edit)
Description Einav Cohen 2012-10-17 09:30:43 EDT
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 09:32:17 EDT
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-21 20:58:48 EDT
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 vszocs 2012-10-22 06:54:28 EDT
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 vszocs 2012-10-22 10:40:11 EDT
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 vszocs 2012-10-22 11:57:54 EDT
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 vszocs 2012-10-22 12:45:47 EDT
u/s patch: http://gerrit.ovirt.org/#/c/8730/
Comment 8 Einav Cohen 2012-10-23 05:39:45 EDT
d/s patch: https://gerrit.eng.lab.tlv.redhat.com/#/c/2809/
Comment 9 Einav Cohen 2012-10-23 11:27:47 EDT
(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 01:07:00 EDT
*** Bug 869845 has been marked as a duplicate of this bug. ***
Comment 11 A S Alam 2012-11-11 21:59:49 EST
Created attachment 643168 [details]
FIXED Screenshot

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

Note You need to log in before you can comment on or make changes to this bug.