• Vegard Nossum's avatar
    docs: translations: use attribute to store current language · b7b2ffc3
    Vegard Nossum authored
    Akira Yokosawa reported [1] that the "translations" extension we added in
    commit 7418ec5b ("docs: translations: add translations links when they
    exist") broke the build on Sphinx versions v6.1.3 through 7.1.2 (possibly
    others) with the following error:
    
        Exception occurred:
          File "/usr/lib/python3.12/site-packages/sphinx/util/nodes.py", line 624, in _copy_except__document
            newnode = self.__class__(rawsource=self.rawsource, **self.attributes)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        TypeError: LanguagesNode.__init__() missing 1 required positional argument: 'current_language'
        The full traceback has been saved in /tmp/sphinx-err-7xmwytuu.log, if you want to report the issue to the developers.
    
    Solve this problem by making 'current_language' a true element attribute
    of the LanguagesNode element, which is probably the more correct way to do
    it anyway.
    
    Tested on Sphinx 2.x, 3.x, 6.x, and...
    b7b2ffc3
translations.py 2.84 KB