-
Notifications
You must be signed in to change notification settings - Fork 356
Closed
Labels
kind: enhancementNew feature or requestNew feature or request
Description
Currently we have several missing translation elements that only exist in English (see this issue for tracking that effort: #257). One challenge with this is that the standard translation infrastructure that Sphinx uses is a bit hard to learn, and not a common workflow.
In the Sphinx Book Theme, we have a little semi-automated translation workflow to try and make translating things easier. I think it could be helpful if we ported this to this theme as well. It involves editing translations in a JSON file rather than dealing with .po and .mo files directly, which I find much easier to wrap your head around.
Overview of the book theme workflow
Essentially it works like this:
- We store translations for each phrase in a dedicated JSON file. For example, the phrase "My phrase" exists in a
My phrase.jsonfile. These are the things that we manually update with new translations. https://github.com/executablebooks/sphinx-book-theme/tree/master/src/sphinx_book_theme/assets/translations/jsons - At build time, we have a script that compiles these JSON files into the
.poand.mofiles that are used by Sphinx in its actual infrastructure. https://github.com/executablebooks/sphinx-book-theme/blob/master/src/sphinx_book_theme/_compile_translations.py - We then define our own message catalog and add it to the Sphinx build's translations: https://github.com/executablebooks/sphinx-book-theme/blob/0b62420c5651f304bb9999990acb115cd9c02886/src/sphinx_book_theme/__init__.py#L58-L60
Metadata
Metadata
Assignees
Labels
kind: enhancementNew feature or requestNew feature or request