diff roundup/i18n.py @ 6672:01216187a167

Testing translations in mailgw.py, update translations, i18n improved i18n.py: translation objects get a _file which is the file that catalog was loaded from. Useful for debugging. mailgw.py: fix code to include roundup.i18n and invoke propert method. GNUMakefile: added roundup.pot target. Also building roundup.pot sets the release version and product code in roundup.pot. Release version from roundup.__init__.py. merged roundup.pot changes into all *.po files. Not sure if the version info in the headers of the .po files is supposed to be updated to match roundup.pot or not. test_mailgw.py: test cases for en and de translations tested. Not sure why I neede to set roundupdb._ and mailgw._, but followed setUp method code and it worked.
author John Rouillard <rouilj@ieee.org>
date Wed, 11 May 2022 21:20:34 -0400
parents 5ad7fb912227
children 00fe67eb8a91
line wrap: on
line diff
--- a/roundup/i18n.py	Wed May 11 01:04:53 2022 -0400
+++ b/roundup/i18n.py	Wed May 11 21:20:34 2022 -0400
@@ -204,10 +204,14 @@
             mo = open(mofile, "rb")
             if translator is None:
                 translator = translation_class(mo)
+                # the .mo file this translator loaded from
+                translator._file = mofile
             else:
                 # note: current implementation of gettext_module
                 #   always adds fallback to the end of the fallback chain.
-                translator.add_fallback(translation_class(mo))
+                fallback = translation_class(mo)
+                fallback._file = mofile
+                translator.add_fallback(fallback)
             mo.close()
         except IOError:
             # ignore unreadable .mo files

Roundup Issue Tracker: http://roundup-tracker.org/