#1958 Provide utilities to validate i18n translations
Closed: Fixed None Opened 12 years ago by jdennis.

Our existing policy is to accept translations provided by translators without review because it was felt only a native speaker could verify the translations were correct. However it is entirely possible for a translation to be malformed. In particular we use substitution variables in a number of our strings. If these substitution variables are mangled by a translator and become syntactically invalid we will throw an exception as a consequence. See ticket #1718 for a real world example. This is a pernicious problem because virtually all our testing is done in our native English which will not throw an exception leading us to believe we're robust. But once someone changes their locale to something else and the .po file for that locale has syntactically invalid substitutions exceptions will be thrown.

We should have tools to validate translations to assure that are not so malformed as to create problems. These validation checks should be performed as part of our build process.

While fixing ticket #1718 I wrote a number of Python based tools to validate different aspects of a po (or pot) file. Because I wrote them to get my own work done they need some polish before deployment. This ticket is to capture a work item to polish up these tools and get them integrated into our process. Since the tools already work this isn't a big work item, they just need some cleaning up and then to be folded into our tool chain. Perhaps they should be given to some upstream location as well (not sure which at the moment).

Also, the version of python-polib (on which these tools are based) need to be upgraded in Fedora because the current 0.5.1 version has bugs, a bz has been opened for that: https://bugzilla.redhat.com/show_bug.cgi?id=744419


Currently the validation checker permits unamed substitutions, i.e. %s for example a string marked for translation might be:

"users in %s are disallowed" % group_name

The problem is that a translator does not know what the %s stands for. Some languages require different ordering than what is utilized in English. It would help a translator provide correct ordering if they knew the intent of the variable substitution, for example:

"users in %(group_name)s are disallowed"

xgettext will emit a warning about such unnamed substitutions but we currently ignore the warning when generating the pot file.

The validation logic should catch these and cause a hard failure so these problems do not persist in the code.

We do not have capacity to do it so we should defer it.

Patch posted

[PATCH 66] Replace broken i18n shell test with Python test

BTW, this was only done because when fixing ticket #2044 I had to update the python i18n test script and since these fixes were just sitting in my home directory waiting to get integrated into the same script it only made sense to do this at the same time.

This was fixed in the follow commit to master:

commit 81c65ee0b2961a96a7a3b2d072f6cb0ec6933a27
Author: John Dennis <jdennis@redhat.com>
Date:   Mon Apr 16 15:51:42 2012 -0400

General backlog was renamed to Beer Exchange

Metadata Update from @jdennis:
- Issue assigned to jdennis
- Issue set to the milestone: Ticket Backlog

7 years ago

Login to comment on this ticket.

Metadata