mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#528: Observe :confval:locale_dirs
when looking for the JS translations file.
This commit is contained in:
parent
eecd8bff03
commit
22777a5128
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
|||||||
Release 1.0.6 (in development)
|
Release 1.0.6 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* #528: Observe :confval:`locale_dirs` when looking for the JS
|
||||||
|
translations file.
|
||||||
|
|
||||||
* #574: Add special code for better support of Japanese documents
|
* #574: Add special code for better support of Japanese documents
|
||||||
in the LaTeX builder.
|
in the LaTeX builder.
|
||||||
|
|
||||||
|
@ -102,15 +102,21 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
self.link_suffix = self.out_suffix
|
self.link_suffix = self.out_suffix
|
||||||
|
|
||||||
if self.config.language is not None:
|
if self.config.language is not None:
|
||||||
jsfile_list = [path.join(package_dir, 'locale',
|
if self._get_translations_js():
|
||||||
self.config.language, 'LC_MESSAGES', 'sphinx.js'),
|
self.script_files.append('_static/translations.js')
|
||||||
path.join(sys.prefix, 'share/sphinx/locale',
|
|
||||||
self.config.language, 'sphinx.js')]
|
|
||||||
|
|
||||||
for jsfile in jsfile_list:
|
def _get_translations_js(self):
|
||||||
if path.isfile(jsfile):
|
candidates = [path.join(package_dir, 'locale', self.config.language,
|
||||||
self.script_files.append('_static/translations.js')
|
'LC_MESSAGES', 'sphinx.js'),
|
||||||
break
|
path.join(sys.prefix, 'share/sphinx/locale',
|
||||||
|
self.config.language, 'sphinx.js')] + \
|
||||||
|
[path.join(dir, self.config.language,
|
||||||
|
'LC_MESSAGES', 'sphinx.js')
|
||||||
|
for dir in self.config.locale_dirs]
|
||||||
|
for jsfile in candidates:
|
||||||
|
if path.isfile(jsfile):
|
||||||
|
return jsfile
|
||||||
|
return None
|
||||||
|
|
||||||
def get_theme_config(self):
|
def get_theme_config(self):
|
||||||
return self.config.html_theme, self.config.html_theme_options
|
return self.config.html_theme, self.config.html_theme_options
|
||||||
@ -526,15 +532,10 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
f.close()
|
f.close()
|
||||||
# then, copy translations JavaScript file
|
# then, copy translations JavaScript file
|
||||||
if self.config.language is not None:
|
if self.config.language is not None:
|
||||||
jsfile_list = [path.join(package_dir, 'locale',
|
jsfile = self._get_translations_js()
|
||||||
self.config.language, 'LC_MESSAGES', 'sphinx.js'),
|
if jsfile:
|
||||||
path.join(sys.prefix, 'share/sphinx/locale',
|
copyfile(jsfile, path.join(self.outdir, '_static',
|
||||||
self.config.language, 'sphinx.js')]
|
'translations.js'))
|
||||||
for jsfile in jsfile_list:
|
|
||||||
if path.isfile(jsfile):
|
|
||||||
copyfile(jsfile, path.join(self.outdir, '_static',
|
|
||||||
'translations.js'))
|
|
||||||
break
|
|
||||||
# then, copy over theme-supplied static files
|
# then, copy over theme-supplied static files
|
||||||
if self.theme:
|
if self.theme:
|
||||||
themeentries = [path.join(themepath, 'static')
|
themeentries = [path.join(themepath, 'static')
|
||||||
|
Loading…
Reference in New Issue
Block a user