[Freeipa-devel] [PATCH 66] Replace broken i18n shell test with Python test

John Dennis jdennis at redhat.com
Thu Mar 22 18:02:14 UTC 2012


[resending because I originally sent this to the wrong list]

This addresses tickets 2044 and 1958. Ticket 2044 was on my short list
but the code had already been written for ticket 1958 (validation of
substitution variables). It had been sitting in my home directory
waiting for integration so since the original 2044 ticket required me to
update test_i18n.py it seemed like a perfect opportunity to get ticket
1958 done as well, it only added 2 hours of additional work.

Summary:

In the install/po directory you can now do this:

% make test
% make validate

Details (aside from what is in the commit message):

Also attached (to prevent line wrapping) is an example of validating the
Spanish translation. It gives a good example of the type of errors it's
capable of finding. This is not abstract, mistakes like these caused us
to throw errors in different locales and since we normally test only
with English it's important to assure the other languages do not cause
Python errors.

We should consider adding the i18n validation to our top level
validation logic so don't allow problems to creep in (our original
non-translated strings are checked too and are just as capable of having
errors as the translated strings).

When I ran the validation on our complete set of files a lot of errors
were reported for

ipalib/plugins/hbactest.py:27
msgid has whitespace between $ and variable in '$ ipa  '

This is due to a doc string with shell command examples, the $
is the shell prompt. The validation code looks for $ followed by a word
token (these are template substitutions). We have a lot of variable and
template substitutions in our strings, any of which could be malformed
and cause serious run-time problems. I don't know of any way to have the
validation logic ignore the use of $ as a shell prompt without adding a
special case exception. Since shell prompts are rarity in strings my
suggestion would be to pick a different shell prompt character,
something other than $ and be done with the issue and not try to
over-engineer the validation logic.

-- 
John Dennis <jdennis at redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: example1.txt
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120322/2c079b83/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-jdennis-0066-Replace-broken-i18n-shell-test-with-Python-test.patch
Type: text/x-patch
Size: 24639 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120322/2c079b83/attachment.bin>


More information about the Freeipa-devel mailing list