Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 777558d

Browse files
mattwang44ken71301
andauthored
fix(doc): refine readme (python#914)
Co-authored-by: Payon <[email protected]>
1 parent e0ffdb0 commit 777558d

File tree

1 file changed

+103
-63
lines changed

1 file changed

+103
-63
lines changed

README.rst

Lines changed: 103 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ the PSF for inclusion in the documentation.
5252
請注意此予翻譯專案的授權:Python 的說明文件是以全球的志工社群來維護。透過張貼\
5353
此專案在 Transifex、GitHub 以及其他公眾場合,以及邀請你參與,我們向你提出一個\
5454
協議:你必須將你對於 Python 說明文件或是 Python 說明文件翻譯的貢獻以 CC0\
55-
(請參考 https://creativecommons.org/publicdomain/zero/1.0/legalcode)的方式\
56-
授權給 PSF 使用。你可以公開地聲明你所貢獻翻譯的部分,並且如果你的翻譯被 PSF
55+
(請參考 https://creativecommons.org/publicdomain/zero/1.0/legalcode/
56+
)的方式授權給 PSF 使用。你可以公開地聲明你所貢獻翻譯的部分,並且如果你的翻譯被 PSF
5757
採用,你可以(但並不須要)送出一個修改,其包含在 Misc/ACKS 或是 TRANSLATORS
5858
檔案裡增加合適的注釋。雖然這個說明文件貢獻協議並沒有說明 PSF 有義務納入你的\
5959
文本貢獻,你在 Python 社群的參與是受歡迎且受感激的。
@@ -75,6 +75,7 @@ the PSF for inclusion in the documentation.
7575

7676
**請注意**: 以下基於 ``make`` 的便捷指令僅能運作於 Unix 系統上(無法使用並不影響主要翻譯流程),\
7777
其他作業系統的使用者在翻譯後可考慮改於 `GitHub Codespace <https://github.com/features/codespaces>`_ 上呼叫 ``make`` 指令。
78+
(參考 `project wiki 頁面 <https://github.com/python/python-docs-zh-tw/wiki/使用-Codespace-開發與預覽頁面>`_)
7879

7980
事先需要有
8081
~~~~~~~~~~
@@ -85,24 +86,24 @@ the PSF for inclusion in the documentation.
8586
- 一個 ``.po`` 檔的編輯器。推薦使用 `Poedit <https://poedit.net>`_,若熟悉 po 檔用一般文字編輯器亦可。
8687
- macOS 的使用者還需要先利用 `homebrew <https://brew.sh/index_zh-tw>`_ 安裝 gettext,屆時 Sphinx 會使用到。
8788

88-
.. code-block:: bash
89+
.. code-block:: bash
8990
90-
brew install gettext
91-
brew link gettext --force
91+
brew install gettext
92+
brew link gettext --force
9293
9394
- 安裝 pre-commit 自動在 commit 時檢查 ``.po`` 檔格式。
9495

95-
.. code-block:: bash
96+
.. code-block:: bash
9697
97-
pip install pre-commit
98-
pre-commit install
98+
pip install pre-commit
99+
pre-commit install
99100
100101
在進行任何動作以前,你必須在 GitHub 上 fork 此專案(按下右上角的 ``Fork``
101102
按鈕),這樣會把整個專案複製一份到你的 GitHub 帳號底下,你可以對這個 fork
102103
進行修改。
103104

104105
第一次貢獻以前(還沒有 clone 過)
105-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106107

107108
請在 terminal 裡依照以下步驟:
108109

@@ -123,88 +124,113 @@ the PSF for inclusion in the documentation.
123124
請遵照以下步驟(`GitHub Flow`_):
124125

125126
.. _GitHub Flow: https://guides.github.com/introduction/flow/
127+
.. _GitHub PR 文件: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request#creating-the-pull-request
126128

127129
首先,`新增一個 issue <https://github.com/python/python-docs-zh-tw/issues>`_\
128-
,如:「翻譯 tutorial/introduction.po」,讓大家知道你正在翻譯這個檔案。可以使用 ``make todo`` 列出尚待翻譯的檔案。
130+
,如:「翻譯 library/math.po」,讓大家知道你正在翻譯這個檔案。待翻譯文件清單請參考\
131+
`此頁面 <https://github.com/python/python-docs-zh-tw/wiki/各檔案翻譯進度清單>`_。
129132

130133
接著在 terminal 裡按照以下步驟:
131134

132-
1. 基於最新版本的 ``upstream/3.12`` 開啟一個 branch,現在假設我們想要翻譯 Glossary \
133-
所以把這個 branch 叫做 ``glossary`` ::
135+
1. 基於最新版本的 ``upstream/3.12`` 開啟一個 branch,現在假設我們想要翻譯 library/math.po \
136+
所以把這個 branch 叫做 ``library/math``:
137+
138+
.. code-block:: bash
139+
140+
git fetch upstream
141+
git checkout -b library/math upstream/3.12
142+
143+
2. 接著就可以開始翻譯(翻譯時可參考\ `翻譯守則`_),你可以手動開啟 Poedit 應用程式再選 \
144+
library/math.po 檔案打開
145+
146+
3. 填入中譯內容並存檔以後,執行以下列指令編譯輸出完整文件,以確保你的修改沒有 reST 的語法錯誤或警告:
147+
134148

135-
git fetch upstream
136-
git checkout -b glossary upstream/3.12
149+
.. code-block:: bash
137150
138-
2. 接著就可以開始翻譯(翻譯時可參考 `翻譯守則`_),你可以手動開啟 Poedit 應用程式再選檔案或用以下指令請 Poedit 將檔案\
139-
打開,翻譯不同檔案時將 glossary 換成別的檔名) ::
151+
make all
140152
141-
poedit glossary.po
142153
143-
3. 存檔以後,執行以下列指令編譯輸出完整文件,以確保你的修改沒有 reST 的語法錯誤或警告 ::
154+
或者只想快速檢查是否有 reST 語法錯誤:
144155

145-
make all
156+
.. code-block:: bash
146157
147-
或者只想快速檢查是否有 reST 語法錯誤 ::
158+
make lint
148159
149-
make lint
150160
151-
確保輸出中沒有任何關於正在翻譯的檔案的警告訊息
161+
確保輸出中沒有任何警告訊息
152162

153-
在 ``make all`` 後,可以使用 ``make build`` 來只對單一 ``.po`` 檔進行編譯,可以節省較多的時間 ::
163+
在 ``make all`` 後,可以使用 ``make build`` 來只對單一 po 檔進行編譯,可以節省較多的時間
154164

155-
make build glossary.po
165+
.. code-block:: bash
156166
157-
如果你還沒有執行 `維護、預覽`_ 的 clone CPython 的動作,此指令會自動幫你 clone CPython,\
167+
make build library/math.po
168+
169+
如果你還沒有執行\ `維護、預覽`_\ 的 clone CPython 的動作,此指令會自動幫你 clone CPython,\
158170
並且會使用 Sphinx 幫你檢查 reST 語法錯誤,我們盡量保持沒有 warning \
159171
的狀態,因此如果有出現 warning 的話請修復它。另外也記得檢查是否符合\
160172
`翻譯守則`_
161173

162-
4. 輸出的文件會被放置在你的本地端 CPython clone(見 `維護、預覽`_ 段落的圖示)\
163-
底下的 ``Doc/build/html``,切換到該目錄再使用 ``python3 -m http.server`` \
164-
或類似的靜態網頁伺服器即可以預覽成果。你可以執行下列指令請瀏覽器打開編譯出來的文件\
165-
以確認整份文件的語意通暢(翻譯別的檔案時將 glossary 換成別的檔名) ::
174+
4. 輸出的文件會被放置在你的本地端 CPython clone(見\ `維護、預覽`_\ 段落的圖示)\
175+
底下的 ``Doc/build/html``,可以使用 `http.server` 或其他靜態網頁伺服器即可以預覽成果。
176+
177+
.. code-block:: bash
178+
179+
cd ../cpython/Doc/build/html
180+
python3 -m http.server
181+
182+
你也可以執行下列指令請瀏覽器打開編譯出來的文件\
183+
以確認整份文件的語意通暢(翻譯別的檔案時將 library/math 換成別的檔名):
184+
185+
.. code-block:: bash
166186
167-
open ../cpython/Doc/build/html/glossary.html
187+
open ../cpython/Doc/build/html/library/math.html
168188
169-
5. 檢查完畢後,即可以將你的翻譯 commit 起來,請使用明確的 commit message ::
189+
5. 檢查完畢後,即可以將你的翻譯 commit 起來,請使用明確的 commit message
170190

171-
git add glossary.po
172-
git commit -m "Working on glossary."
191+
.. code-block:: bash
192+
193+
git add library/math.po
194+
git commit -m "Working on library/math.po"
173195
174196
6. 將你的修改 push 到你的 GitHub clone 上。為了簡單,我們可以用 ``origin HEAD``
175-
來告訴 git 我們將修改 push 到 origin,branch 則和本機端的 branch 名稱一樣 ::
197+
來告訴 git 我們將修改 push 到 origin,branch 則和本機端的 branch 名稱一樣:
198+
199+
.. code-block:: bash
176200
177-
git push origin HEAD
201+
git push origin HEAD
178202
179-
7. 這時候你就可以打開一個 pull request 了,請打開
180-
https://github.com/python/python-docs-zh-tw,你會看到一個「Compare & Pull
181-
Request」按鈕,按下它就可以對此專案發送一個 pull request。
203+
7. 這時候你就可以打開一個 pull request 了:請打開\ `此專案的 GitHub 頁面 <https://github.com/python/python-docs-zh-tw>`_,\
204+
你會看到一個「Compare & Pull Request」按鈕,按下它就可以對此專案發送一個 pull request(參考 `GitHub PR 文件`_)。
182205

183206
8. 如果有人在 GitHub 上 review 了你的 pull request,並且你想要修改你的內容,\
184-
那麼(如果你切換到了別的 branch 上)你要先切換回到你的 branch 上 ::
207+
那麼(如果你切換到了別的 branch 上)你要先切換回到你的 branch 上:
208+
209+
.. code-block:: bash
185210
186-
git checkout glossary
211+
git checkout library/math
187212
188-
接著修改你要修正的問題,並再次 commit、push ::
213+
接著修改你要修正的問題,並再次 commit、push
189214

190-
git add glossary.po
191-
git commit -m "glossary: small fixes"
192-
git push origin HEAD
215+
.. code-block:: bash
216+
217+
git add library/math.po
218+
git commit -m "fix(library/math): resolve review comments"
219+
git push origin HEAD
193220
194221
這整個流程裡有幾件事情值得注意:
195222

196223
- 從 upstream(我們的主要 GitHub repo)做 fetch 的動作
197224
- 對 origin(你的 fork)做 push
198-
- 永遠不對 ``3.12`` branch 進行修改,請保持讓這個 branch 唯讀,可以避免\
199-
掉很多問題。
225+
- 永遠不對 ``3.12`` branch 進行修改,請保持讓這個 branch 唯讀,可以避免掉很多問題。
200226

201227
要翻譯哪些東西
202228
--------------
203229

204230
主要是填入翻譯字串 (*msgstr*) 以及更新有標記為 ``#, fuzzy`` 的字串。
205231

206-
其中最簡單的貢獻方式就是更新 *fuzzy entries*,讓曾經翻譯的內容保持與最新版本的文件\
207-
同步。請參考 `尋找有翻譯過但需校閱的 fuzzy entries`_ 段落。
232+
其中最簡單的貢獻方式就是更新 *fuzzy entries*,讓曾經翻譯的內容保持與最新版本的文件
233+
同步。請參考\ `尋找有翻譯過但需校閱的 fuzzy entries`_ 段落。
208234

209235
此外,當前的目標為完成 **Tutorial** 的翻譯,因此在 ``tutorial/`` 底下的所有
210236
po 檔皆為首要的翻譯對象。你也可以幫忙校對已經翻譯過的內容。
@@ -225,7 +251,7 @@ po 檔皆為首要的翻譯對象。你也可以幫忙校對已經翻譯過的
225251

226252
例如:使用 CPU 運算、使用「CPU」運算
227253

228-
#. 專有名詞應該參考 `術語表 Glossary`_ 裡翻譯方式
254+
#. 專有名詞應該參考\ `術語表 Glossary`_ 裡的翻譯方式
229255

230256
#. 專有名詞可以選擇不翻譯。
231257

@@ -241,8 +267,9 @@ po 檔皆為首要的翻譯對象。你也可以幫忙校對已經翻譯過的
241267

242268
#. 務必保留 reStructuredText 格式(如:超連結名稱)
243269

244-
#. po 檔單行不應超過 79 字元寬度(Poedit 會處理,但也可以使用 `poindent
245-
<https://pypi.org/project/poindent/>`_ 來確保格式)
270+
#. po 檔單行不應超過 79 字元寬度(Poedit 會處理,但也可以使用 `powrap
271+
<https://github.com/python/python-docs-zh-tw/wiki/%E5%90%84%E7%A8%AE-CLI-%E5%B0%8F%E5%B7%A5%E5%85%B7#powrap>`_
272+
來確保格式)
246273

247274
#. 高頻詞保留原文。因為翻譯後不一定能較好理解市面上 Python 的文章。 這些高頻詞\
248275
在 Glossary 中的譯文仍保持原文,並加註市面上的翻譯。
@@ -265,14 +292,27 @@ po 檔皆為首要的翻譯對象。你也可以幫忙校對已經翻譯過的
265292
- 在超文件標示語言 (HTML) 中應注意跳脫符號。
266293

267294
reST 語法注意事項
268-
----------------
295+
---------------------
269296

270297
- ``:xxx:`...``` 即為 reST 的語法,應該在譯文中保留。
271-
- reST 諸多語法需要保留前後的空白。在中文裡,該空白可以用 :literal:`\\\ \ `
272-
來取代,製造一個沒有寬度的分隔符號。
273298

274299
例如:
275300

301+
.. code-block:: rst
302+
303+
Avoids tests using :func:`type` or :func:`isinstance`.
304+
305+
翻譯為
306+
307+
.. code-block:: rst
308+
309+
避免使用 :func:`type` 或 :func:`isinstance` 進行測試。
310+
311+
- reST 諸多語法需要保留前後的空白。在中文裡,該空白可以用 :literal:`\\\\\ \ ` \
312+
來取代,製造一個沒有寬度的分隔符號。
313+
314+
例如當 ``:ref:`detail-instruction`` 部分會被編譯為中文時:
315+
276316
.. code-block:: rst
277317
278318
For more information, please see :ref:`detail-instruction`.
@@ -281,7 +321,7 @@ reST 語法注意事項
281321

282322
.. code-block:: rst
283323
284-
更多資訊請參考\ :ref:`detail-instruction`\
324+
更多資訊請參考\\ :ref:`detail-instruction`。
285325
286326
- 超連結語法該要在譯文中保留原字串。
287327

@@ -291,19 +331,19 @@ reST 語法注意事項
291331
292332
`Documentation bugs`_ on the Python issue tracker
293333
294-
應更改為
334+
應翻譯為
295335

296336
.. code-block:: rst
297337
298-
Python issue tracker 上\ `文件相關的錯誤 <Documentation bugs_>`_
338+
Python issue tracker 上\\ `文件的錯誤 <Documentation bugs_>`_
299339
300-
才能正確顯示為「Python issue tracker 上\ `文件相關的錯誤 <#>`_」,連結與\
340+
才能正確顯示為「Python issue tracker 上\ `文件的錯誤 <#>`_」,並帶有正確連結且與\
301341
前文才不會有多餘的空白。
302342

303343
- 舉例中有程式碼時,前一段經常為 ``::`` 結尾,此記號\ `具有特殊意義
304-
<http://www.sphinx-doc.org/en/stable/rest.html#source-code>`_,除了該段落\
305-
結尾為冒號外,也代表下段縮排為程式碼。翻譯時應改為全型冒號,並\ **增加以**
306-
``::`` **開頭的新段落**
344+
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks>`_,\
345+
除了該段落結尾為冒號外,也代表下段縮排為程式碼。翻譯時應改為 ``: ::``\
346+
(參考 `#568 <https://github.com/python/python-docs-zh-tw/discussions/568>`_)
307347

308348
例如:
309349

@@ -329,8 +369,8 @@ reST 語法注意事項
329369
術語表 Glossary
330370
===============
331371

332-
為了讓翻譯保持統一,我們整理了一份 \
333-
`術語列表 <https://github.com/python/python-docs-zh-tw/wiki/%E8%A1%93%E8%AA%9E%E5%88%97%E8%A1%A8>`_ \
372+
為了讓翻譯保持統一,我們整理了一份\
373+
`術語列表 <https://github.com/python/python-docs-zh-tw/wiki/%E8%A1%93%E8%AA%9E%E5%88%97%E8%A1%A8>`_\
334374
如果翻譯過程中你覺得需要術語列表有所缺漏,請至 `Discussion \
335375
<https://github.com/python/python-docs-zh-tw/discussions>`_ 開啟新的討論補充術語。\
336376
新增的術語,將會於每次 Sprint 中共同討論是否合併進術語列表。

0 commit comments

Comments
 (0)