Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #4734 -- Changed message extraction to permit non-ACSII msgid s…

…trings.

Thanks, krzysiek.pawlik@silvermedia.pl.

This is slightly backwards-incompatible for translators: PO files are now
assumed to be in UTF-8 encoding.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5708 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0dbc0ab338e10f1aa594eb962fb30e2047559536 1 parent 5fbc589
Malcolm Tredinnick authored July 15, 2007

Showing 1 changed file with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. 11  django/bin/make-messages.py
11  django/bin/make-messages.py
@@ -103,8 +103,8 @@ def make_messages():
103 103
                         open(os.path.join(dirpath, '%s.py' % file), "wb").write(templatize(src))
104 104
                         thefile = '%s.py' % file
105 105
                     if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
106  
-                    cmd = 'xgettext %s -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (
107  
-                        os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile))
  106
+                    cmd = 'xgettext -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (
  107
+                        domain, os.path.join(dirpath, thefile))
108 108
                     (stdin, stdout, stderr) = os.popen3(cmd, 'b')
109 109
                     msgs = stdout.read()
110 110
                     errors = stderr.read()
@@ -116,13 +116,18 @@ def make_messages():
116 116
                         old = '#: '+os.path.join(dirpath, thefile)[2:]
117 117
                         new = '#: '+os.path.join(dirpath, file)[2:]
118 118
                         msgs = msgs.replace(old, new)
  119
+                    if os.path.exists(potfile):
  120
+                        # Strip the header
  121
+                        msgs = '\n'.join(msgs.split('\n')[17:])
  122
+                    else:
  123
+                        msgs = msgs.replace('charset=CHARSET', 'charset=UTF-8')
119 124
                     if msgs:
120 125
                         open(potfile, 'ab').write(msgs)
121 126
                     if thefile != file:
122 127
                         os.unlink(os.path.join(dirpath, thefile))
123 128
 
124 129
         if os.path.exists(potfile):
125  
-            (stdin, stdout, stderr) = os.popen3('msguniq "%s"' % potfile, 'b')
  130
+            (stdin, stdout, stderr) = os.popen3('msguniq --to-code=utf-8 "%s"' % potfile, 'b')
126 131
             msgs = stdout.read()
127 132
             errors = stderr.read()
128 133
             if errors:

0 notes on commit 0dbc0ab

Please sign in to comment.
Something went wrong with that request. Please try again.