Fixed #4734 -- Changed message extraction to permit non-ACSII msgid strings.
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
This commit is contained in:
parent
5fbc589014
commit
0dbc0ab338
|
@ -103,8 +103,8 @@ def make_messages():
|
||||||
open(os.path.join(dirpath, '%s.py' % file), "wb").write(templatize(src))
|
open(os.path.join(dirpath, '%s.py' % file), "wb").write(templatize(src))
|
||||||
thefile = '%s.py' % file
|
thefile = '%s.py' % file
|
||||||
if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
|
if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
|
||||||
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"' % (
|
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"' % (
|
||||||
os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile))
|
domain, os.path.join(dirpath, thefile))
|
||||||
(stdin, stdout, stderr) = os.popen3(cmd, 'b')
|
(stdin, stdout, stderr) = os.popen3(cmd, 'b')
|
||||||
msgs = stdout.read()
|
msgs = stdout.read()
|
||||||
errors = stderr.read()
|
errors = stderr.read()
|
||||||
|
@ -116,13 +116,18 @@ def make_messages():
|
||||||
old = '#: '+os.path.join(dirpath, thefile)[2:]
|
old = '#: '+os.path.join(dirpath, thefile)[2:]
|
||||||
new = '#: '+os.path.join(dirpath, file)[2:]
|
new = '#: '+os.path.join(dirpath, file)[2:]
|
||||||
msgs = msgs.replace(old, new)
|
msgs = msgs.replace(old, new)
|
||||||
|
if os.path.exists(potfile):
|
||||||
|
# Strip the header
|
||||||
|
msgs = '\n'.join(msgs.split('\n')[17:])
|
||||||
|
else:
|
||||||
|
msgs = msgs.replace('charset=CHARSET', 'charset=UTF-8')
|
||||||
if msgs:
|
if msgs:
|
||||||
open(potfile, 'ab').write(msgs)
|
open(potfile, 'ab').write(msgs)
|
||||||
if thefile != file:
|
if thefile != file:
|
||||||
os.unlink(os.path.join(dirpath, thefile))
|
os.unlink(os.path.join(dirpath, thefile))
|
||||||
|
|
||||||
if os.path.exists(potfile):
|
if os.path.exists(potfile):
|
||||||
(stdin, stdout, stderr) = os.popen3('msguniq "%s"' % potfile, 'b')
|
(stdin, stdout, stderr) = os.popen3('msguniq --to-code=utf-8 "%s"' % potfile, 'b')
|
||||||
msgs = stdout.read()
|
msgs = stdout.read()
|
||||||
errors = stderr.read()
|
errors = stderr.read()
|
||||||
if errors:
|
if errors:
|
||||||
|
|
Loading…
Reference in New Issue