Bug 769471

Summary: Variables to be checked for consistency
Product: [Retired] Zanata Reporter: Alex Eng <aeng>
Component: Component-UIAssignee: Alex Eng <aeng>
Status: CLOSED CURRENTRELEASE QA Contact: Ding-Yi Chen <dchen>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.5CC: damason, zanata-bugs
Target Milestone: ---Keywords: UserStory
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-23 04:33:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Alex Eng 2011-12-20 23:15:26 UTC
Variables like %s or %d are included in strings and any discrepancy in them may generate an error for the translation. Common errors include mismatch in their number or if these are translated.


This will include a number of different validation checks that can be enabled independently for different source document types.

NB Python printf  (checked for order) and Java MessageFormat only

Examples of some strings with variables:


msgid "Loading %d file…"
msgid_plural "Loading %d files…"
msgstr[0] ""
msgstr[1] ""

msgid "Loading file '%s'…"

msgid "Changes made to the document in the last hour and %d minute will be  permanently lost."

msgid "Found and replaced %d occurrences"


msgid "Root node of '%s' must be <evoldap>, not <%s>"

msgid "Contacting LDAP server: host '%s', port '%d', base DN '%s'"

msgid "Error saving GConf tree to '%s': %s\n"

msgid "Failed to give up lock on XML directory \"%s\": %s"

msgid "Could not stat `%s': %s"

Comment 1 Alex Eng 2012-01-02 22:10:14 UTC
Implementation should detect any variables that starts with % follow by variable name.

Comment 2 Alex Eng 2012-01-02 23:06:49 UTC
Implemented in 1.5 branch. See https://github.com/zanata/zanata/commit/942b44ce93e958e02afe03bd0e4b31cd95b91a1b

Comment 4 David Mason 2012-01-19 07:39:08 UTC
 - updated to use localisable message strings
 - updated printf matching regex to match most standard variable patterns