[FIX] legal: fix some broken links (pdfs, translations)
1) PDF files are generated and stored at the root of the CURRENT_BRANCH directory. The links to those files are generated at different levels of the doctree, which makes it impossible to use a relative path. For example the same "Enterprise Agreement" doc in EN is published on: - /16.0/legal/terms/enterprise.html - /16.0/fr/legal/terms/enterprise.html As a workaround, use absolute links for the PDFs. They won't work locally for now. Can be improved later, as long as we don't break those links located in various depths of the troctree. 2) The legal constracts aren't translated in all availables languages (yet), so those links are 404s now. Introduced a conf.py variable `legal_translations` with the list of languages where translated contracts are indeed available, and falling back to the EN version otherwise. Some languages don't have *all* the contracts translated, so some 404 may remain temporarily.
This commit is contained in:
@@ -291,6 +291,12 @@ latex_documents = [
|
||||
'odoo_partnership_agreement_es.tex', 'Odoo Partnership Agreement (ES)', '', 'howto'),
|
||||
]
|
||||
|
||||
# List of languages that have legal translations (excluding EN). The keys must be in
|
||||
# `languages_names`. These translations will have a link to their versions of the legal
|
||||
# contracts, instead of the default EN one. The main legal documents are not part of the
|
||||
# translations since they have legal meaning.
|
||||
legal_translations = ['de', 'es', 'fr', 'nl']
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of the title page.
|
||||
latex_logo = 'static/img/odoo_logo.png'
|
||||
|
||||
@@ -397,6 +403,10 @@ def _generate_alternate_urls(app, pagename, templatename, context, doctree):
|
||||
)
|
||||
)
|
||||
|
||||
# Dynamic generation of localized legal doc links
|
||||
context['legal_translations'] = legal_translations
|
||||
|
||||
|
||||
def _build_url(_version=None, _lang=None):
|
||||
if app.config.is_remote_build:
|
||||
# Project root like https://www.odoo.com/documentation
|
||||
|
||||
Reference in New Issue
Block a user