mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix a regression that broke msgfmt for non-ascii strings in 3.45 on python2
This commit is contained in:
parent
78f1896c69
commit
449240222b
@ -112,6 +112,7 @@ def make(filename, outfile):
|
|||||||
ID = 1
|
ID = 1
|
||||||
STR = 2
|
STR = 2
|
||||||
CTXT = 3
|
CTXT = 3
|
||||||
|
unicode_prefix = 'u' if sys.version_info.major < 3 else ''
|
||||||
|
|
||||||
# Compute .mo name from .po name and arguments
|
# Compute .mo name from .po name and arguments
|
||||||
if filename.endswith('.po'):
|
if filename.endswith('.po'):
|
||||||
@ -202,10 +203,8 @@ def make(filename, outfile):
|
|||||||
l = l.strip()
|
l = l.strip()
|
||||||
if not l:
|
if not l:
|
||||||
continue
|
continue
|
||||||
l = ast.literal_eval(l)
|
l = ast.literal_eval(unicode_prefix + l)
|
||||||
lb = l
|
lb = l.encode(encoding)
|
||||||
if not isinstance(lb, bytes):
|
|
||||||
lb = lb.encode(encoding)
|
|
||||||
if section == CTXT:
|
if section == CTXT:
|
||||||
msgctxt += lb
|
msgctxt += lb
|
||||||
elif section == ID:
|
elif section == ID:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user