mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Make our custom compile_catalog command work with Babel 2.3
In new Babel versions, self.domain is a list rather than a string.
This commit is contained in:
parent
1959dfe8d9
commit
65638c12b8
17
setup.py
17
setup.py
@ -97,6 +97,13 @@ else:
|
||||
def run(self):
|
||||
compile_catalog.run(self)
|
||||
|
||||
if isinstance(self.domain, list):
|
||||
for domain in self.domain:
|
||||
self._run_domain_js(domain)
|
||||
else:
|
||||
self._run_domain_js(self.domain)
|
||||
|
||||
def _run_domain_js(self, domain):
|
||||
po_files = []
|
||||
js_files = []
|
||||
|
||||
@ -105,20 +112,20 @@ else:
|
||||
po_files.append((self.locale,
|
||||
os.path.join(self.directory, self.locale,
|
||||
'LC_MESSAGES',
|
||||
self.domain + '.po')))
|
||||
domain + '.po')))
|
||||
js_files.append(os.path.join(self.directory, self.locale,
|
||||
'LC_MESSAGES',
|
||||
self.domain + '.js'))
|
||||
domain + '.js'))
|
||||
else:
|
||||
for locale in os.listdir(self.directory):
|
||||
po_file = os.path.join(self.directory, locale,
|
||||
'LC_MESSAGES',
|
||||
self.domain + '.po')
|
||||
domain + '.po')
|
||||
if os.path.exists(po_file):
|
||||
po_files.append((locale, po_file))
|
||||
js_files.append(os.path.join(self.directory, locale,
|
||||
'LC_MESSAGES',
|
||||
self.domain + '.js'))
|
||||
domain + '.js'))
|
||||
else:
|
||||
po_files.append((self.locale, self.input_file))
|
||||
if self.output_file:
|
||||
@ -126,7 +133,7 @@ else:
|
||||
else:
|
||||
js_files.append(os.path.join(self.directory, self.locale,
|
||||
'LC_MESSAGES',
|
||||
self.domain + '.js'))
|
||||
domain + '.js'))
|
||||
|
||||
for js_file, (locale, po_file) in zip(js_files, po_files):
|
||||
infile = open(po_file, 'r')
|
||||
|
Loading…
Reference in New Issue
Block a user