Mercurial > p > roundup > code
diff roundup/msgfmt.py @ 7788:a9bac0cb4019
feat: make msgfmt.py a simple CLI replacement for msgfmt(1)
Simplify testing .po files if the tester doesn't have access to GNU
gettest tools or doesn't want to install the python Babel package.
Also mentioned in developers.txt.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 06 Mar 2024 13:12:21 -0500 |
| parents | 6a1c1cd69582 |
| children | 37a98ec62e2e |
line wrap: on
line diff
--- a/roundup/msgfmt.py Tue Mar 05 13:03:46 2024 -0500 +++ b/roundup/msgfmt.py Wed Mar 06 13:12:21 2024 -0500 @@ -282,3 +282,15 @@ def getAsFile(self): return BytesIO(self.get()) + + +if __name__ == '__main__': + # a really dumb attempt to make this into a command + # Usage: python msgfmy.py <input_file>.po <output_file>.mo + import sys + + mo = Msgfmt(sys.argv[1]).get() + with open(sys.argv[2], 'wb') as mofile: + mofile.write(mo) + mofile.close() +
