Bug 882761

Summary: RFE-[WebTrans] Python Validator
Product: [Retired] Zanata Reporter: Ding-Yi Chen <dchen>
Component: ProjectType-CodeAssignee: Isaac Rooskov <irooskov>
Status: CLOSED DEFERRED QA Contact: Zanata-QA Mailling List <zanata-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 2.0CC: dchen, hpeters, mkim, sflaniga, yshao, zanata-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 882729 Environment:
Last Closed: 2015-02-25 06:17:01 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:

Description Ding-Yi Chen 2012-12-03 04:27:25 UTC
+++ 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.

=============================================================
Python validator need to deal with 2 cases:

1. C-like conversion specifiers, such as %d, %x
2. Conversion specifiers with mapping key, such as '%(language)s has %(number)03d quote types.'

Comment 1 Michelle Kim 2015-02-25 06:17:01 UTC
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.