這是 Python 3.12 官方說明文件的臺灣繁體中文(zh_TW)翻譯。
翻譯之前,請務必詳讀並同意授權與 License。參與方式請參考參與翻譯。
你可以在 https://python.github.io/python-docs-zh-tw/ 瀏覽目前翻譯的成果。
想問問題、認識翻譯同好,歡迎加入 Discord 頻道 discord.gg/44XheGXhWH
目錄 Table of Contents
以下為 Documentation Contribution Agreement,說明文件貢獻協議,請在貢獻以前務必詳讀以下內容。原文後附有中文翻譯,但譯文不保證完全正確,請以原文為準。
NOTE REGARDING THE LICENSE FOR TRANSLATIONS: Python's documentation is maintained using a global network of volunteers. By posting this project on Transifex, GitHub, and other public places, and inviting you to participate, we are proposing an agreement that you will provide your improvements to Python's documentation or the translation of Python's documentation for the PSF's use under the CC0 license (available at https://creativecommons.org/publicdomain/zero/1.0/legalcode). In return, you may publicly claim credit for the portion of the translation you contributed and if your translation is accepted by the PSF, you may (but are not required to) submit a patch including an appropriate annotation in the Misc/ACKS or TRANSLATORS file. Although nothing in this Documentation Contribution Agreement obligates the PSF to incorporate your textual contribution, your participation in the Python community is welcomed and appreciated.
You signify acceptance of this agreement by submitting your work to the PSF for inclusion in the documentation.
請注意此予翻譯專案的授權:Python 的說明文件是以全球的志工社群來維護。透過張貼此專案在 Transifex、GitHub 以及其他公眾場合,以及邀請你參與,我們向你提出一個協議:你必須將你對於 Python 說明文件或是 Python 說明文件翻譯的貢獻以 CC0(請參考 https://creativecommons.org/publicdomain/zero/1.0/legalcode/ )的方式授權給 PSF 使用。你可以公開地聲明你所貢獻翻譯的部分,並且如果你的翻譯被 PSF 採用,你可以(但並不須要)送出一個修改,其包含在 Misc/ACKS 或是 TRANSLATORS 檔案裡增加合適的注釋。雖然這個說明文件貢獻協議並沒有說明 PSF 有義務納入你的文本貢獻,你在 Python 社群的參與是受歡迎且受感激的。
你在對 PSF 送出說明文件貢獻的同時,即表示同意上述的協議。
此為所需翻譯的文字檔,副檔名為 .po
,不同語系就會有一個 po 檔。主要內容為翻譯的參考原始字串 (msgid),及需要填入的翻譯字串 (msgstr)。有時你會看到 #, fuzzy
的註記,它代表此翻譯字串需要校閱。
請注意: 以下基於 make
的便捷指令僅能運作於 Unix 系統上(無法使用並不影響主要翻譯流程),其他作業系統的使用者在翻譯後可考慮改於 GitHub Codespace 上呼叫 make
指令。
(參考 project wiki 頁面)
一個 GitHub 帳號
安裝好 git(Windows 上請參考 https://gitforwindows.org/)
一個
.po
檔的編輯器。推薦使用 Poedit,若熟悉 po 檔用一般文字編輯器亦可。macOS 的使用者還需要先利用 homebrew 安裝 gettext,屆時 Sphinx 會使用到。
brew install gettext brew link gettext --force
安裝 pre-commit 自動在 commit 時檢查
.po
檔格式。pip install pre-commit pre-commit install
在進行任何動作以前,你必須在 GitHub 上 fork 此專案(按下右上角的 Fork
按鈕),這樣會把整個專案複製一份到你的 GitHub 帳號底下,你可以對這個 fork
進行修改。
請在 terminal 裡依照以下步驟:
# 用 git clone 將你的 fork 下載到本機端
git clone git@github.com:<你的 GitHub 帳號>/python-docs-zh-tw.git
# 進入 clone 下來的資料夾裡:
cd python-docs-zh-tw/
# 將 python/python-docs-zh-tw 設為 upstream remote
git remote add upstream https://github.com/python/python-docs-zh-tw.git
請遵照以下步驟(GitHub Flow):
首先,新增一個 issue,如:「翻譯 library/math.po」,讓大家知道你正在翻譯這個檔案。待翻譯文件清單請參考此頁面。
接著在 terminal 裡按照以下步驟:
基於最新版本的
upstream/3.12
開啟一個 branch,現在假設我們想要翻譯 library/math.po 所以把這個 branch 叫做library/math
:git fetch upstream git checkout -b library/math upstream/3.12