Closes #7887: Updated the sphinx.js locale json dump to indent for readability. Changed files to open with utf8 encoding

This commit is contained in:
Charles 2020-06-30 14:44:34 -04:00
parent 61c9aa584c
commit 68abe09afe

View File

@ -139,7 +139,7 @@ else:
domain + '.js'))
for js_file, (locale, po_file) in zip(js_files, po_files):
with open(po_file) as infile:
with open(po_file, encoding='utf8') as infile:
catalog = read_po(infile, locale)
if catalog.fuzzy and not self.use_fuzzy:
@ -157,13 +157,13 @@ else:
msgid = msgid[0]
jscatalog[msgid] = message.string
with open(js_file, 'wt') as outfile:
with open(js_file, 'wt', encoding='utf8') as outfile:
outfile.write('Documentation.addTranslations(')
dump({
'messages': jscatalog,
'plural_expr': catalog.plural_expr,
'locale': str(catalog.locale)
}, outfile, sort_keys=True)
}, outfile, sort_keys=True, indent=4)
outfile.write(');')
cmdclass['compile_catalog'] = compile_catalog_plusjs