mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix i18n: message catalogs are not compiled when specific build (refs: #4560)
sphinx-build skips message catalog builds if specific filename are given as arguments.
This commit is contained in:
parent
51a0f709b5
commit
afbd27f996
2
CHANGES
2
CHANGES
@ -20,6 +20,8 @@ Bugs fixed
|
||||
* #4531: autosummary: methods are not treated as attributes
|
||||
* #4538: autodoc: ``sphinx.ext.autodoc.Options`` has been moved
|
||||
* #4539: autodoc emits warnings for partialmethods
|
||||
* i18n: message catalogs are not compiled if specific filenames are given for
|
||||
``sphinx-build`` as arguments (refs: #4560)
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -16,7 +16,7 @@ from docutils import nodes
|
||||
|
||||
from sphinx.deprecation import RemovedInSphinx20Warning
|
||||
from sphinx.environment.adapters.asset import ImageAdapter
|
||||
from sphinx.util import i18n, path_stabilize, logging, status_iterator
|
||||
from sphinx.util import i18n, logging, status_iterator
|
||||
from sphinx.util.console import bold # type: ignore
|
||||
from sphinx.util.i18n import find_catalog
|
||||
from sphinx.util.osutil import SEP, ensuredir, relative_uri
|
||||
@ -255,11 +255,14 @@ class Builder(object):
|
||||
# type: (List[unicode]) -> None
|
||||
def to_domain(fpath):
|
||||
# type: (unicode) -> unicode
|
||||
docname, _ = path.splitext(path_stabilize(fpath))
|
||||
dom = find_catalog(docname, self.config.gettext_compact)
|
||||
return dom
|
||||
docname = self.env.path2doc(path.abspath(fpath))
|
||||
if docname:
|
||||
return find_catalog(docname, self.config.gettext_compact)
|
||||
else:
|
||||
return None
|
||||
|
||||
specified_domains = set(map(to_domain, specified_files))
|
||||
specified_domains.discard(None)
|
||||
catalogs = i18n.find_catalog_source_files(
|
||||
[path.join(self.srcdir, x) for x in self.config.locale_dirs],
|
||||
self.config.language,
|
||||
|
@ -65,7 +65,7 @@ def test_compile_specific_catalogs(app, status, warning):
|
||||
return set(find_files(catalog_dir, '.mo'))
|
||||
|
||||
actual_on_boot = get_actual() # sphinx.mo might be included
|
||||
app.builder.compile_specific_catalogs(['admonitions'])
|
||||
app.builder.compile_specific_catalogs([app.srcdir / 'admonitions.txt'])
|
||||
actual = get_actual() - actual_on_boot
|
||||
assert actual == set(['admonitions.mo'])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user