[cc-commits] [SCM] A place to dump one-off scripts that might be useful to look at in the future. (branch master) updated. ba5748cae8b394b7d9d68d074155a05a7d3f8c42

Gitosis User git at gandi0.creativecommons.org
Wed Jan 11 16:36:00 EST 2012


The branch, master has been updated
       via  ba5748cae8b394b7d9d68d074155a05a7d3f8c42 (commit)
      from  5348646c45c48d8d7dd5dd62f7f49b3578c9db41 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ba5748cae8b394b7d9d68d074155a05a7d3f8c42
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date:   Wed Jan 11 15:37:45 2012 -0600

    Strip message context, which prevents proper .mo compiling from po files.

-----------------------------------------------------------------------

Summary of changes (followed by patch):
 convert_pofiles.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/convert_pofiles.py b/convert_pofiles.py
index 17fe578..f15d416 100644
--- a/convert_pofiles.py
+++ b/convert_pofiles.py
@@ -16,13 +16,20 @@
 
 import re
 import sys
+from babel.messages.pofile import read_po
+from cc.i18n.tools.support import polib_wrapped_write_po
+
 
 def convert_pofile(filename):
     podata = file(filename, 'r').read()
     converted = re.sub(
         "\$\{?(.+?)\}", lambda x: "%(" + x.groups()[0] + ")s", podata)
     file(filename, 'w').write(converted)
+    pofile = read_po(file(filename, 'r'))
+    for msg in pofile:
+        msg.context = None
 
+    polib_wrapped_write_po(filename, pofile)
 
 def main():
     filenames = sys.argv[1:]


hooks/post-receive
-- 
A place to dump one-off scripts that might be useful to look at in the future.


More information about the cc-commits mailing list