You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
context
When I compile my markdown files to HTML using sphinx_proof with language settings to German, the titles of most of the proof boxes are translated correctly (some are missing) but the cross references to these boxes stay in English language.
expectation
I expect that the titles in cross references are also translated according to the language settings.
problem
This gives inconsistent results in books that are not written in English language.
Reproduce the bug
Add the following to your _config.yml:
sphinx:
extra_extensions:
- sphinx_proofconfig:
language: de
Compile book to HTML with jupyter-book build .
Observe build result in folder _build/html/
List your environment
Version of sphinx-proof: 0.2.0
jupyter-book --version
Jupyter Book : 1.0.3
External ToC : 1.0.1
MyST-Parser : 2.0.0
MyST-NB : 1.1.2
Sphinx Book Theme : 1.1.3
Jupyter-Cache : 1.0.0
NbClient : 0.10.0
python --version
Python 3.12.7
Operating System: ArchLinux
Probably you are using the pip installed package of sphinx-proof, which unfortunately doesn't include the directory sphinx_proof/translations/jsons with the needed translations (you can verify on PyPI).
To make this work you need to clone this repository and add Spanish translations in some of the json files as follows:
Clone the repository, e.g., git clone https://github.com/executablebooks/sphinx-proof.git ~/sphinx-proof
Add translations in the files in ~/sphinx-proof/sphinx_proof/translations/jsons/ (see my commit for example)
Generate the translation binaries via python ~/sphinx-proof/sphinx_proof/translations/_convert.py
Link the package into your virtual environment, e.g., via ln -s ~/sphinx-proof/sphinx_proof ~/my_book_project/.venv/lib/python3.12/site-packages/sphinx_proof
Configure your sphinx settings in the file ~/my_book_project/_config.yml with:
sphinx:
extra_extensions:
- sphinx_proofconfig:
language: es
It would be great if you could create a pull request for your contribution of Spanish translations. :)
I've just realised that my changes only affect the titles of the directives, but not the cross references. But if I understood it correctly, once my code and your code get merged the spanish cross references will also work.
Activity
MPenaR commentedon Nov 10, 2024
I have the same setting but with "language: es" expecting to get the spanish but they are in english (both titles and references).
Is this feature only available in german?
dtenbrinck commentedon Nov 10, 2024
Probably you are using the pip installed package of
sphinx-proof, which unfortunately doesn't include the directorysphinx_proof/translations/jsonswith the needed translations (you can verify on PyPI).To make this work you need to clone this repository and add Spanish translations in some of the json files as follows:
git clone https://github.com/executablebooks/sphinx-proof.git ~/sphinx-proof~/sphinx-proof/sphinx_proof/translations/jsons/(see my commit for example)python ~/sphinx-proof/sphinx_proof/translations/_convert.pyln -s ~/sphinx-proof/sphinx_proof ~/my_book_project/.venv/lib/python3.12/site-packages/sphinx_proof~/my_book_project/_config.ymlwith:It would be great if you could create a pull request for your contribution of Spanish translations. :)
MPenaR commentedon Nov 10, 2024
Thank you for the detailed explanation, that way not only will be able to have spanish translations but I also learn XD
I'll try to do it this evening
MPenaR commentedon Nov 10, 2024
When I run the
python _convert.pyit complains about not finding the file or directorymsgfmt. Do you know which is the minimal enviroment I need?MPenaR commentedon Nov 10, 2024
For someone in the future, in debian the utility
msgfmtis installed with the packagegettextMPenaR commentedon Nov 10, 2024
I think I did it correctly. It's in pull request #127
dtenbrinck commentedon Nov 10, 2024
Great work! I hope our pull requests will be merged soon into
sphinx-proof. 👍MPenaR commentedon Nov 10, 2024
I've just realised that my changes only affect the titles of the directives, but not the cross references. But if I understood it correctly, once my code and your code get merged the spanish cross references will also work.
Am I right?
dtenbrinck commentedon Nov 11, 2024
Yes, my changes should work for any translation. You can test it by merging my commit into your code.
MPenaR commentedon Nov 11, 2024
Done in commit d1c7e9c and working nicely in my book ( it also passes the tox tests)
Danke schöne!
MPenaR commentedon Nov 11, 2024
At the beggining of a "proof" directive it is still read proof independently of the language used:

Is this a feature or a bug?
dtenbrinck commentedon Nov 11, 2024
I think this is fixed in this open pull request.
MPenaR commentedon Nov 13, 2024
I see, thank you very much