From 95b64ca2de3c7332b821398fa1fec389a5ec4fef Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Tue, 25 Apr 2017 16:18:26 +0200 Subject: [PATCH] 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). --- _extensions/odoo/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/_extensions/odoo/__init__.py b/_extensions/odoo/__init__.py index bb0cac558..9744f826b 100644 --- a/_extensions/odoo/__init__.py +++ b/_extensions/odoo/__init__.py @@ -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')