使用 Sphinx 翻譯說明文件¶
Sphinx 是用來建立漂亮文件的工具。它使用了簡單的 reStructuredText 語法,並以多種格式輸出。如果要找個範例,那麼本文件也是用它來建置的。使用 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.
|
|
|
|
|
|
gettext PO 檔案 |
|
|
用來比對出翻譯檔案的正規表達式 |
|
自訂組件名稱 |
|
定義新翻譯的基礎檔案 |
|
提示
您希望 Sphinx 產生只是單一的 PO 檔案嗎?從 Sphinx 3.3.0 開始可以實現,使用:
gettext_compact = "docs"
You can find several documentation projects being translated using this approach: