Re: [PATCH v2] docs: translations: add translations links when they exist

From: Vegard Nossum
Date: Fri Dec 15 2023 - 10:05:01 EST



On 15/12/2023 13:37, Vegard Nossum wrote:
Add a new Sphinx extension that knows about the translations of kernel
documentation and can insert links to the translations at the top of
the document.

It basically works like this:

1. Register a new node type, LanguagesNode.

2. Register a new transform, TranslationsTransform, that inserts a new
LanguageNode at the top of every document. The LanguageNode contains
"pending references" to translations of the document. The key here
is that these are pending (i.e. unresolved) references that may or
may not actually exist.

3. Register a 'doctree-resolved' event that iterates over all the
LanguageNode nodes. Any unresolved references are filtered out; the
list of resolved references is passed to the 'translations.html'
template and rendered as an HTML node (if HTML output is selected).

Testing: make htmldocs, make latexdocs with Sphinx v4.3.2 and Firefox.

Oh no, there's still a problem. If I run make htmldocs, make latexdocs,
make htmldocs, then all the translation menus disappear from the HTML.

So ignore this for now.

If anybody has a solution feel free to respond with it.


Vegard