Vertalen van de documentatie met Sphinx

Sphinx is een programma voor het maken van prachtige documentatie. Het gebruikt de eenvoudige syntaxis reStructuredText en kan uitvoer genereren in vele indelingen. Als u zoekt naar een voorbeeld, deze documentatie wordt er ook mee gebouwd. De zeer nuttige metgezel voor het gebruiken van Sphinx is de service Read the Docs, die uw documentatie gratis zal bouwen en publiceren.

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 Internationalization. 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 Onderdeel opsporing add-on to automatically discover all others.

Configuratie onderdeel

Naam van onderdeel

Documentation

Bestandsmasker

docs/locales/*/LC_MESSAGES/index.po

Sjabloon voor nieuwe vertalingen

docs/locales/index.pot

Bestandsformaat

gettext PO-bestand

Vlaggen voor vertaling

rst-text

Onderdeel opsporing configureren

Reguliere uitdrukking om vertaalbestanden mee te vergelijken

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

Onderdeelnaam aanpassen

Documentation: {{ component|title }}

Geef het basisbestand voor nieuwe vertalingen op

docs/locales/{{ component }}.pot

Hint

Heeft u liever dat Sphinx slechts een enkel PO-bestand maakt? Vanaf Sphinx 3.3.0 kunt u dat bereiken met:

gettext_compact = "docs"

U kunt verscheidene documentatieprojecten vinden die met deze benadering zijn vertaald: