mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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:
parent
61c9aa584c
commit
68abe09afe
6
setup.py
6
setup.py
@ -139,7 +139,7 @@ else:
|
|||||||
domain + '.js'))
|
domain + '.js'))
|
||||||
|
|
||||||
for js_file, (locale, po_file) in zip(js_files, po_files):
|
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)
|
catalog = read_po(infile, locale)
|
||||||
|
|
||||||
if catalog.fuzzy and not self.use_fuzzy:
|
if catalog.fuzzy and not self.use_fuzzy:
|
||||||
@ -157,13 +157,13 @@ else:
|
|||||||
msgid = msgid[0]
|
msgid = msgid[0]
|
||||||
jscatalog[msgid] = message.string
|
jscatalog[msgid] = message.string
|
||||||
|
|
||||||
with open(js_file, 'wt') as outfile:
|
with open(js_file, 'wt', encoding='utf8') as outfile:
|
||||||
outfile.write('Documentation.addTranslations(')
|
outfile.write('Documentation.addTranslations(')
|
||||||
dump({
|
dump({
|
||||||
'messages': jscatalog,
|
'messages': jscatalog,
|
||||||
'plural_expr': catalog.plural_expr,
|
'plural_expr': catalog.plural_expr,
|
||||||
'locale': str(catalog.locale)
|
'locale': str(catalog.locale)
|
||||||
}, outfile, sort_keys=True)
|
}, outfile, sort_keys=True, indent=4)
|
||||||
outfile.write(');')
|
outfile.write(');')
|
||||||
|
|
||||||
cmdclass['compile_catalog'] = compile_catalog_plusjs
|
cmdclass['compile_catalog'] = compile_catalog_plusjs
|
||||||
|
Loading…
Reference in New Issue
Block a user