diff options
author | John Dennis <jdennis@redhat.com> | 2010-02-10 11:57:58 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-02-11 14:58:39 -0500 |
commit | eadca473a935a7b8b73185c4a4a540f510064fec (patch) | |
tree | 801d14b4033ace4ea312cb205dc00ee4591fd76a /install/po/test_i18n.py | |
parent | dc2f246d478c948c180102d93d814f5bf5dbba89 (diff) | |
download | freeipa-eadca473a935a7b8b73185c4a4a540f510064fec.tar.gz freeipa-eadca473a935a7b8b73185c4a4a540f510064fec.tar.xz freeipa-eadca473a935a7b8b73185c4a4a540f510064fec.zip |
Make test_i18n.py diagnostics friendlier
Diffstat (limited to 'install/po/test_i18n.py')
-rwxr-xr-x | install/po/test_i18n.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/install/po/test_i18n.py b/install/po/test_i18n.py index 8560fc8f..be74d49b 100755 --- a/install/po/test_i18n.py +++ b/install/po/test_i18n.py @@ -39,6 +39,8 @@ suffix = u'\u2190' # utf-8 == '\xe2\x86\x90' def main(): + test_file = 'test.po' + try: # The test installs the test message catalog under the en_US (e.g. U.S. English) @@ -53,28 +55,30 @@ def main(): gettext.install('ipa', 'test_locale', unicode=1) # We need a translatable string to test with, read one from the test po file - msgid = get_msgid('test.po') + msgid = get_msgid(test_file) + + print "Using message string \"%s\" found in file \"%s\"" % (msgid, test_file) # Get the translated version of the msgid string by invoking _() translated = _(msgid) # Verify the first character is the test prefix if translated[0] != prefix: - raise ValueError("first char in (%s) not equal to prefix (%s)" % \ + raise ValueError("First char in translated string \"%s\" not equal to prefix \"%s\"" % \ (translated.encode('utf-8'), prefix.encode('utf-8'))) # Verify the last character is the test suffix if translated[-1] != suffix: - raise ValueError("last char in (%s) not equal to suffix (%s)" % \ + raise ValueError("Last char in translated string \"%s\" not equal to suffix \"%s\"" % \ (translated.encode('utf-8'), suffix.encode('utf-8'))) # Verify everything between the first and last character is the # original untranslated string if translated[1:-1] != msgid: - raise ValueError("interior of (%s) not equal to msgid (%s)" % \ + raise ValueError("Translated string \"%s\" minus the first & last character is not equal to msgid \"%s\"" % \ (translated.encode('utf-8'), msgid)) - print "success: %s = %s" % (msgid, _(msgid).encode('utf-8')) + print "Success: message string \"%s\" maps to translated string \"%s\"" % (msgid, _(msgid).encode('utf-8')) except Exception, e: print >> sys.stderr, "ERROR: %s" % e return 1 |