Traducción de documentación utilizando Sphinx

Sphinx es una herramienta para crear documentos bonitos. Utiliza sintaxis simple de reStructuredText y puede generar la salida en muchos formatos. Si estás buscando un ejemplo, esta documentación es también creada utilizándola. El complemento más útil para utilizar Sphinx es el servicio Leer los Docs, que creará y publicará tu documentación de forma libre.

I will not focus on writing documentation itself, if you need guidance with that, just follow instructions on the Sphinx website. Once you have documentation ready, translating it is quite easy as Sphinx comes with support for this and it is quite nicely covered in their Internacionalización. It’s matter of a few configuration directives and invoking the sphinx-intl tool.

If you are using Read the Docs service, you can start building translated documentation on Read the Docs. Their Localization and Internationalization covers pretty much everything you need - creating another project, setting its language, and linking it from the main project as a translation.

Now all you need is translating the documentation content. Sphinx generates PO file for each directory or top-level file, which can lead to quite a lot of files to translate (depending on gettext_compact settings). You can import the index.po into Weblate as an initial component and then configure Detección de componentes add-on to automatically discover all others.

Configuración de componentes

Nombre de componente

Documentation

Máscara de archivos

docs/locales/*/LC_MESSAGES/index.po

Plantilla para traducciones nuevas

docs/locales/index.pot

Formato de archivo

Archivo PO de gettext

Indicadores de traducción

rst-text

Configuración de detección de componentes

Expresión regular utilizada para relacionar con los archivos de traducción

docs/locales/(?P<language>[^/.]*)/LC_MESSAGES/(?P<component>[^/]*)\.po

Personalizar el nombre del componente

Documentation: {{ component|title }}

Definir el archivo de base para traducciones nuevas

docs/locales/{{ component }}.pot

Consejo

¿Preferías que Sphinx genere solo un único archivo PO? Desde Sphinx 3.3.0, puedes hacerlo utilizando:

gettext_compact = "docs"

Puede encontrar varios proyectos de documentación siendo traducidos utilizando este planteamiento: