Merge pull request #11629 from abhishekbalam/get_untranslated_fix_v13

fix(Translation): Change file open write mode in get-untranslated command
This commit is contained in:
mergify[bot] 2020-10-03 16:50:36 +00:00 committed by GitHub
commit ab496a50dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -620,7 +620,7 @@ def get_untranslated(lang, untranslated_file, get_all=False):
if get_all:
print(str(len(messages)) + " messages")
with open(untranslated_file, "w") as f:
with open(untranslated_file, "wb") as f:
for m in messages:
# replace \n with ||| so that internal linebreaks don't get split
f.write((escape_newlines(m[1]) + os.linesep).encode("utf-8"))
@ -633,10 +633,10 @@ def get_untranslated(lang, untranslated_file, get_all=False):
if untranslated:
print(str(len(untranslated)) + " missing translations of " + str(len(messages)))
with open(untranslated_file, "w") as f:
with open(untranslated_file, "wb") as f:
for m in untranslated:
# replace \n with ||| so that internal linebreaks don't get split
f.write(cstr(frappe.safe_encode(escape_newlines(m) + os.linesep)))
f.write((escape_newlines(m) + os.linesep).encode("utf-8"))
else:
print("all translated!")