8000 Fix custom translator setup · lap-odoo/documentation-user@95b64ca · GitHub
[go: up one dir, main page]

Skip to content

Commit 95b64ca

Browse files
authored
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).
1 parent 0bffbb2 commit 95b64ca
< 8000 /div>

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

_extensions/odoo/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
import sphinx.builders.html
99
from docutils import nodes
1010
def setup(app):
11-
if getattr(app.config, 'html_translator_class', None):
12-
app.warn("Overriding the explicitly set html_translator_class setting",
13-
location="odoo extension")
14-
app.config.html_translator_class = 'odoo.translator.BootstrapTranslator'
11+
if hasattr(app, 'set_translator'):
12+
app.set_translator('html', translator.BootstrapTranslator)
13+
else:
14+
if getattr(app.config, 'html_translator_class', None):
15+
app.warn("Overriding the explicitly set html_translator_class setting",
16+
location="odoo extension")
17+
app.config.html_translator_class = 'odoo.translator.BootstrapTranslator'
1518

1619
switcher.setup(app)
1720
app.add_config_value('odoo_cover_default', None, 'env')

0 commit comments

Comments
 (0)
0