Sphinx를 사용한 문서 번역

Sphinx 는 아름다운 문서를 만드는 도구입니다. 간단한 reStructuredText 구문을 사용하고 다양한 형식의 출력을 생성할 수 있습니다. 예를 들어, 이 문서도 Sphinx를 사용하여 작성되었습니다. Sphinx를 사용할 때 매우 유용한 도구인 Read the Docs 서비스는 문서를 무료로 작성하고 게시해 줍니다.

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 구성요소 발견 add-on to automatically discover all others.

구성요소 설정

구성요소 이름

Documentation

파일 마스크

docs/locales/*/LC_MESSAGES/index.po

신규 번역의 템플릿

docs/locales/index.pot

파일 형식

gettext PO 파일

번역 플래그

rst-text

구성요소 자동 검색 구성

번역 파일과 일치시킬 정규 표현식

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

구성요소 이름 사용자 정의

Documentation: {{ component|title }}

새 번역을 위한 기본 파일 정의

docs/locales/{{ component }}.pot

힌트

Sphinx가 단일 PO 파일만 생성하도록 하시겠습니까? Sphinx 3.3.0부터 다음을 사용하여 이를 달성할 수 있음:

gettext_compact = "docs"

이 접근 방식을 사용하여 번역되는 여러 문서 프로젝트를 찾을 수 있음: