The diagnostic messages in test_i18n.py were a bit confusing
because it didn't indicate what the test string was and where
it came from. Hopefully this is clearer now.
--
John Dennis <jden...@redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
From c81728580e4e5f43d5cd35a0d48073e63d2cfe05 Mon Sep 17 00:00:00 2001
From: John Dennis <jden...@redhat.com>
Date: Wed, 10 Feb 2010 11:57:58 -0500
Subject: [PATCH] Make test_i18n.py diagnostics friendlier

---
 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 8560fc8..be74d49 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
-- 
1.6.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to