Liang-Bo Wang (亮亮), 2016-06-03
By Liang2 under CC 4.0 BY license
Esc to overview
← → to navigate
sphinx-quickstart
建立 Sphinx 文件結構index.rst
或增加新的 rst 頁面make html
輸出 HTML 文件conf.py
修改demo_sphinx
├── _build/
├── Makefile
├── make.bat
├── conf.py
├── index.rst
├── intro.rst
└── api.rst
Welcome to Demo project for sphinx-intl's documentation!
========================================================
We will use this to demo the usage of `sphinx-intl`_.
Make sure you make installed all the required packages:
.. code-block:: bash
pip install -r requirements.txt
Then try to write some more pages.
Contents:
.. toctree::
:maxdepth: 2
intro
api
index.rst
Intro
=====
Sphinx
------
**Sphinx** is an excellent Python documentation generator. From |Wikipedia|_,
Sphinx is a documentation generator, heavily used (and written) by the
Python community. It's also written in Python (a programming language); but
used by many other environments.
.. |Wikipedia| replace:: *Wikipedia*
.. _Wikipedia: https://en.wikipedia.org/wiki/Sphinx_%28documentation_generator%29
It use reStructuredText (rst) for as the markup language for documents. An
rst document usually looks like:
intro.rst
GNU ``gettext`` API
===================
Extract some docstring of :mod:`gettext` here (see the `full module description`_).
.. function:: gettext(message)
Return the localized translation of *message*, based on the current global
domain, language, and locale directory. This function is usually aliased as
:func:`_` in the local namespace (see examples below).
.. _full module description: https://docs.python.org/3.5/library/gettext.html
Here's an example of typical usage for this API:
.. code-block:: python3
import gettext
gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')
# ...
api.rst
.pot
翻譯字串模版.po
,.po
建立 .mo
binary 格式Ref: Typical gettext workflow on Wikipedia
by Quicksilver (CC BY-SA 3.0)
#: ../../index.rst:15
msgid "Then try to write some more pages."
msgstr "接著試著撰寫一些頁面。"
#: ../../index.rst:17
msgid "Contents:"
msgstr "內容:"
make gettext
建立 .pot 翻譯模版sphinx-intl update -l zh_Hant
make -e SPHINXOPTS="-D language='zh_Hant'" html
\ 就這麼簡單 /
流程示意圖:
Ref: Workflow visualization of translations in Sphinx, Sphinx Internationalization
*.pot
以及 *.po
加到版本控制即可demo_sphinx/
├── _build/
│ ├── doctrees/
│ └── html/
├── Makefile
├── make.bat
├── conf.py
├── *.rst
└── locale/
├── pot/
│ └── *.pot
└── zh_Hant/
└── LC_MESSAGES/
├── *.mo
└── *.po
git checkout e294445
切換不同 commit
「原文」連結連回官方英文版同標題處
tutorial--controlflow
點擊 "Update Translation" 連結,查看 doc page build 排程
工作完成後,可以看排程實際執行了哪些指令,或 build doc 有沒有錯誤。
僅參與翻譯的話,一行指令都不用下
對想要離線使用的人,參考 wiki 說明(跟前半場 talk 操作類似),新的翻譯每天都會自動加回 git repo 中。
盡量讓環境的建立都有文件,可以推坑傳承。避免一年後的自己都搞不懂
Modified from リトルウィッチアカデミア (Little Witch Academia), 2013
類型 | 翻譯條目數 | 字數 | 內容 |
---|---|---|---|
tutorial/* | 0.8k | 25k | 給初學者的教學 |
installing/*, using/* | 0.8k | 15k | 在各系統上安裝與使用 |
howto/* | 2k | 60k | 針對套件的詳細教學 |
reference/* | 13k | 38k | Python 語言定義 |
library/* | 25k | 513k | 標準函式庫 (stdlib) |
TOTAL | 42k | 661k |
(word count using pocount from translation-toolkit)
Ref: Amazon
魔戒三部曲 + 前傳 (= 560k)
Ref: Amazon
冰與火之歌前兩部 (= 624k)
Ref リトルウィッチアカデミア 魔法仕掛けのパレード (Little Witch Academia: The Enchanted Parade), 2015
本來是要帥氣地在 PyCon TW 宣布 tutorial 完成翻譯的,
但申請學校 + 畢業 + PyCon TW 議程長負擔真的有點多……
Tutorial 以外的內容,除了參與翻譯外,也歡迎各位贊助
如果贊助成真,收集到的資金將由第三方統籌並公開收支(PyCon TW?)
歡迎加入專案或來信至 me@liang2.tw
PGP fingerprint 6ECD C5B8 235C D44D 2471 866E 30A4 5011 B233 544E
Ref リトルウィッチアカデミア 魔法仕掛けのパレード (Little Witch Academia: The Enchanted Parade), 2015
My goodbye gift before leaving Taiwan :)
(Yap, I know I haven't changed my protrait photo since 2014)