Closed CptShooter closed 4 weeks ago
Hey there 👋🏽 I am not sure I am following entirely, but are you trying to translate your project's documentation? As you have for example an English version, Spanish, Greek, and so on vs. Translation of the theme's components themselves?
If the former you might want to make sure the .po
/ locales path is properly set. Per the code snippets you shared I cannot see any direct references to your locales files/directories and / or wether the configuration needed in config.py is as expected
Yes I'm trying to translate my project's documentation (.rst files) using sphinx build-in commands.
sphinx-build -b gettext source build/gettext/en/dev
And that command is not working returning pydata_sphinx_theme exceptions.
This does not seem an issue with the PyData Sphinx Theme itself as we have no configurations or components that would directly affect translation or internationalization.
This seems rather a misconfiguration of locale settings or .po
files missing. These po
files should contain the translations for your documentation site.
Could you check against the Sphinx translation link you shared that these are correctly set on your end and that the locale directory for translations exist in the correct location?
This command should create .pot files, it's a first step. And it is problem with PyData Sphinx Theme. I've changed to Read the Docs Theme and command works fine.
Can you share the full tracelog for the command and not just the exception?
(venv) PS D:\Repository\sphinx\docs> sphinx-build -b gettext source build/gettext --show-traceback
Running Sphinx v7.3.7
loading pickled environment... done
Traceback (most recent call last):
File "D:\Repository\sphinx\docs\venv\Lib\site-packages\sphinx\events.py", line 97, in emit
results.append(listener.handler(self.app, *args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Repository\sphinx\docs\venv\Lib\site-packages\pydata_sphinx_theme\translator.py", line 88, in setup_translators
app.builder.default_translator_class,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MessageCatalogBuilder' object has no attribute 'default_translator_class'. Did you mean: 'get_translator_class'?
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Repository\sphinx\docs\venv\Lib\site-packages\sphinx\cmd\build.py", line 332, in build_main
app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Repository\sphinx\docs\venv\Lib\site-packages\sphinx\application.py", line 268, in __init__
self._init_builder()
File "D:\Repository\sphinx\docs\venv\Lib\site-packages\sphinx\application.py", line 339, in _init_builder
self.events.emit('builder-inited')
File "D:\Repository\sphinx\docs\venv\Lib\site-packages\sphinx\events.py", line 108, in emit
raise ExtensionError(
sphinx.errors.ExtensionError: Handler <function setup_translators at 0x000001A34C6B31A0> for event 'builder-inited' threw an exception (exception: 'MessageCatalogBuilder' object has no attribute 'default_translator_class')
Extension error (pydata_sphinx_theme.translator):
Handler <function setup_translators at 0x000001A34C6B31A0> for event 'builder-inited' threw an exception (exception: 'MessageCatalogBuilder' object has no attribute 'default_translator_class')
I have tried to reproduce the issue and not been able to do it with the development version neither the latest version on pypi. Could you try and generate a more minimal example? Or share which versions and extensions are you using?
What I have used is https://github.com/OriolAbril/sphinx-playground/tree/f23fa85415258396b603c66d82cc0d2dff5d4c55. It has a single page but uses this theme and I am able to generate the .pot files without problem. Maybe there is an incompatibility with another extension or some kind of version incompatibility, but it looks like simply using the theme doesn't result in this error
Ok I see my mistake. I'have added
extensions = [ "pydata_sphinx_theme", ]
If you add this to your code, then You can replicate an error. I don't know why I kept adding it. Maybe because RTD Theme has it.
https://sphinx-rtd-theme.readthedocs.io/en/latest/installing.html
Without adding pydata_sphinx_theme to extensions it works fine.
Thanks
I'm having troubles to generate translations using your theme. Using this https://www.sphinx-doc.org/en/master/usage/advanced/intl.html#quick-guide
I have builded my project normally using this:
When im running:
Then error occurs:
So I managed to skip that adding this to
conf.py
After that it was almost good but now I'm getting this at the end of generation:
After 3h I gave up. So my question is only, is this theme supports translations or I'm missing something in config?