Fix custom translator setup

Programmatically setting html_translator_class is apparently broken in
Sphinx 1.5 (which sorta makes sense, it's a bit of a hack, I'm not sure
why we even did that instead of going through the configuration object).
This commit is contained in:
xmo-odoo 2017-04-25 16:18:26 +02:00 committed by GitHub
parent 0bffbb2865
commit 95b64ca2de

View File

@ -8,10 +8,13 @@ import sphinx.environment
import sphinx.builders.html
from docutils import nodes
def setup(app):
if getattr(app.config, 'html_translator_class', None):
app.warn("Overriding the explicitly set html_translator_class setting",
location="odoo extension")
app.config.html_translator_class = 'odoo.translator.BootstrapTranslator'
if hasattr(app, 'set_translator'):
app.set_translator('html', translator.BootstrapTranslator)
else:
if getattr(app.config, 'html_translator_class', None):
app.warn("Overriding the explicitly set html_translator_class setting",
location="odoo extension")
app.config.html_translator_class = 'odoo.translator.BootstrapTranslator'
switcher.setup(app)
app.add_config_value('odoo_cover_default', None, 'env')