Bug 882760 - RFE - [WebTrans] Ruby Validator
RFE - [WebTrans] Ruby Validator
Status: CLOSED DEFERRED
Product: Zanata
Classification: Community
Component: ProjectType-Code (Show other bugs)
2.0
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Isaac Rooskov
Zanata-QA Mailling List
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-02 23:00 EST by Ding-Yi Chen
Modified: 2015-08-06 01:54 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 882729
Environment:
Last Closed: 2015-02-25 01:15: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)

  None (edit)
Description Ding-Yi Chen 2012-12-02 23:00:01 EST
+++ This bug was initially created as a clone of Bug #882729 +++

Created attachment 656308 [details]
False validation warnings

Description of problem:
Variables in the format '%{pool}' seem to trip up the validation check, which issues false warnings.


Steps to Reproduce:
1. See https://translate.zanata.org/zanata/webtrans/translate?project=cfse&iteration=sam-1.2&localeId=de-DE&locale=de#view:doc;doc:app 
2. Row 331

--- Additional comment from Hedda Peters on 2012-12-03 10:32:21 EST ---

Additional information:

In other entries similar variables don't seem to cause this problem, see row 578 of the same project - no validation warnings there with similar variables.


Side note:

Going back a few pages to look at row 331 again, I noticed that the editor shows "Validation Warnings: None", until I click into that entry. As soon as that entry has focus, the message changes to "Validation Warnings: 1". 
It would make more sense to have any validation warnings displayed accurately regardless of whether or not that particular entry is focussed. The message "Validation warning: None" is otherwise misleading.

--- Additional comment from Sean Flanigan on 2012-12-03 11:23:06 EST ---

These strings are actually not Java MessageFormat variables, they just look similar.  You can tell by the '%' before the '{'.  You need to disable Java variable validation while working on this document.  (We plan to let project maintainers do this as a persistent setting in the DB.)

We probably should have an RFE for validating this sort of variable (Python? Ruby?).

Anyway, this is happening because of quoting.  The English string contains "couldn't", and the apostrophe in "couldn't" is starting a quoted section.  Java MessageFormat doesn't look for variables inside the quoted section, so the validation doesn't either.


And Hedda's side note shows why showing the validations at all times is non-trivial to implement properly (until we store validation policies/results in the DB).  At the very least, the message shouldn't say "Validation Warnings:" until it has run the validations for that row.

============================================
Ruby validator need to deal with 3 cases:

1. C-like conversion specifiers, such as %d, %x
2. String interpolation, such as #{variable}
3. str % arg for ruby >=1.9, such as %{arg}
http://ruby-doc.org/core-1.9.3/String.html
Comment 1 Michelle Kim 2015-02-25 01:15:49 EST
Not enough demand for this feature at this stage. 
We may look into ways to validation better way such as plug-in approach in the future.

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