diff --git a/CHANGES b/CHANGES index 7822d6120..25f662a85 100644 --- a/CHANGES +++ b/CHANGES @@ -44,6 +44,8 @@ Incompatible changes * Fix ``genindex.html`` to satisfy xhtml standard. * Use epub3 builder by default. And the old epub builder is renamed to epub2. * Fix ``epub`` and ``epub3`` builders that contained links to ``genindex`` even if ``epub_use_index = False``. +* `html_translator_class` is now deprecated. + Use `Sphinx.set_translator()` API instead. Features added -------------- diff --git a/doc/config.rst b/doc/config.rst index d3589c57f..52aa0992b 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -910,6 +910,11 @@ that use Sphinx's HTMLWriter class. .. seealso:: :meth:`~sphinx.application.Sphinx.set_translator` + .. deprecated:: 1.5 + + Implement your translator as extension and use `Sphinx.set_translator` + instead. + .. confval:: html_show_copyright If true, "(C) Copyright ..." is shown in the HTML footer. Default is diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index cf423624c..c5d165bee 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -1183,6 +1183,12 @@ class JSONHTMLBuilder(SerializingHTMLBuilder): SerializingHTMLBuilder.init(self) +def validate_config_values(app): + if app.config.html_translator_class: + app.warn('html_translator_class is deprecated. ' + 'Use Sphinx.set_translator() API instead.') + + def setup(app): # builders app.add_builder(StandaloneHTMLBuilder) @@ -1191,6 +1197,8 @@ def setup(app): app.add_builder(PickleHTMLBuilder) app.add_builder(JSONHTMLBuilder) + app.connect('builder-inited', validate_config_values) + # config values app.add_config_value('html_theme', 'alabaster', 'html') app.add_config_value('html_theme_path', [], 'html')