Bug 769471 - Variables to be checked for consistency
Summary: Variables to be checked for consistency
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-UI
Version: 1.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Alex Eng
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-20 23:15 UTC by Alex Eng
Modified: 2012-04-23 04:33 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-23 04:33:24 UTC


Attachments (Terms of Use)

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.

http://translate.sourceforge.net/wiki/toolkit/pofilter_tests#variables
http://translate.sourceforge.net/wiki/toolkit/pofilter

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:

gedit:
=====

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"


gconf:
=====

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

See
https://github.com/zanata/zanata/commit/f8eaaa0666357c6fe284d6cf4618650ec3513fc0
https://github.com/zanata/zanata/compare/e69ee68374a74eac8535980bc7dd833ba7795b83...030653ed8063238147f95b7219d0838f75150194


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