The Wayback Machine - http://web.archive.org/web/20250406144813/https://github.com/python/python-docs-zh-tw
Skip to content

python/python-docs-zh-tw

Repository files navigation

Python 官方說明文件臺灣繁體中文翻譯計畫

Join Chat on Discord

 Python 3.13 zh_TW

 License

 https://python.github.io/python-docs-zh-tw/ 

 Discord  discord.gg/44XheGXhWH

 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  TransifexGitHub  Python  Python  CC0 https://creativecommons.org/publicdomain/zero/1.0/legalcode/  PSF 使 PSF  Misc/ACKS  TRANSLATORS  PSF  Python 

 PSF 

 .popo (msgid) (msgstr) #, fuzzy 

請注意: 以下基於 make 的便捷指令僅能運作於 Unix 系統上(無法使用並不影響主要翻譯流程),其他作業系統的使用者在翻譯後可考慮改於 GitHub Codespace 上呼叫 make 指令。 (參考 project wiki 頁面


  •  GitHub 


     gitWindows  https://gitforwindows.org/


     .po 使 Poeditpo


     uv Installation uv便


    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.13  branch library/math.po  branch  library/math
git fetch upstream
git checkout -b library/math upstream/3.13
  • 接著就可以開始翻譯(翻譯時可參考翻譯守則),你可以手動開啟 Poedit 應用程式再選 library/math.po 檔案打開

  • 填入中譯內容並存檔以後,執行以下列指令編譯輸出完整文件,以確保你的修改沒有 reST 的語法錯誤或警告:

    make all

    或者只想快速檢查是否有 reST 語法錯誤:

    make lint

    確保輸出中沒有任何警告訊息。

    make all 後,可以使用 make build 來只對單一 po 檔進行編譯,可以節省較多的時間:

    make build library/math.po

     clone CPython  clone CPython使 Sphinx  reST  warning  warning 


     CPython clone Doc/build/html使 http.server 
    cd ../cpython/Doc/build/html
    python3 -m http.server

    你也可以執行下列指令請瀏覽器打開編譯出來的文件以確認整份文件的語意通暢(翻譯別的檔案時將 library/math 換成別的檔名):

    open ../cpython/Doc/build/html/library/math.html
  • 檢查完畢後,即可以將你的翻譯 commit 起來,請使用明確的 commit message:

    git add library/math.po
    git commit -m "Working on library/math.po"
  • 將你的修改 push 到你的 GitHub clone 上。為了簡單,我們可以用 origin HEAD 來告訴 git 我們將修改 push 到 origin,branch 則和本機端的 branch 名稱一樣:

    git push origin HEAD

  •  pull request  GitHub Compare & Pull Request pull request GitHub PR 


     GitHub  review  pull request branch  branch 
    git checkout library/math

    接著修改你要修正的問題,並再次 commit、push:

    git add library/math.po
    git commit -m "fix(library/math): resolve review comments"
    git push origin HEAD
  • 這整個流程裡有幾件事情值得注意:

    • 從 upstream(我們的主要 GitHub repo)做 fetch 的動作
    • 對 origin(你的 fork)做 push
    • 永遠不對 3.13 branch 進行修改,請保持讓這個 branch 唯讀,可以避免掉很多問題。

     (msgstr)  #, fuzzy 

     fuzzy entries  fuzzy entries 

     Tutorial  tutorial/ po




    1. 使



      Python is supported by Python Software Foundation (PSF).




      使 CPU 使CPU


       Glossary 




      CPUUnicode




       (regular expression)

      Network News Transfer ProtocolPortable Network Graphics


       reStructuredText 


      po79Poedit 使 powrap


       Python   Glossary 

      intfloatstrbyteslisttuple dictsetiteratorgeneratoriterable pickle

    使使




    list Python 

    使 zip(*[iter(x)]*n) Python 

     (HTML) 

    • :xxx:`...` 即為 reST 的語法,應該在譯文中保留。

      例如:

      Avoids tests using :func:`type` or :func:`isinstance`.

      翻譯為

      避免使用 :func:`type` 或 :func:`isinstance` 進行測試。
    • reST 諸多語法需要保留前後的空白。在中文裡,該空白可以用 \\ 來取代,製造一個沒有寬度的分隔符號。

      例如當 :ref:`detail-instruction 部分會被編譯為中文時:

      For more information, please see :ref:`detail-instruction`.

      翻譯為

      更多資訊請參考\\ :ref:`detail-instruction`。
    • 超連結語法該要在譯文中保留原字串。

      例如:

      `Documentation bugs`_ on the Python issue tracker

      應翻譯為

      Python issue tracker 上\\ `文件的錯誤 <Documentation bugs_>`_

      Python issue tracker 


       ::   :: #568


      Here is a code example::
      
        import sys
        print(sys.version)

      程式碼並不會出現在 po 檔之中,故在 po 檔中會顯示為

      Here is a code example::

      此時翻譯應為:

      以下是個程式範例: ::

     Discussion  Sprint 

     Issue使 Discord

     coordinator  mattwang44  josix email mattwang44 at gmail dot com, josixwang at gmail dot com

    以下的指令皆預設在本機端 python-docs-zh-tw clone 的根目錄執行,同時預設在同一個目錄底下有一個 CPython clone,如下:

    ~/
    ├── python-docs-zh-tw/
    └── cpython/
    

    若要在本機端 clone 一個 CPython,可以使用以下指令:

    $ git clone --depth 1 --no-single-branch https://github.com/python/cpython.git

    這樣可以避免下載完整的 commit 歷史(對輸出文件沒什麼幫助),但仍然能把所有的 branch clone 下來。

    pot 檔為翻譯的樣板檔案,它包含需要翻譯的原始字串 (msgid) 跟其對應的空白翻譯字串 (msgstr),此步驟會參考最新的 CPython 中的 pot 檔來更新 po 檔。如果是之前在 po 檔中已填入過翻譯字串但參考的 pot 檔的 msgid 已有變動,則此指令會自動加上 #, fuzzy 的標記,代表內容有些許差異需要更新。

    $ make merge

    po #, fuzzy  fuzzy entryLinux  #, fuzzy  (msgstr) Fuzzy entries 
    $ make fuzzy

    This translation project was created by Liang-Bo Wang in late-2015, the translations were hosted on https://docs.python.org.tw/3, and the project includes daily auto-build sever, documentation website enhancement for translations and project management on the python-doc-tw GitHub organisation. The translations were done on Transifex, with our own translation team and project. People who've contributed on this Transifex project are listed in TRANSLATORS

    In mid-2018, thanks to PEP 545 and the Doc-SIG community, this project has migrated to Python's Github organisation and will become the official Taiwanese Mandarin translation of the documentation.

    This translation project is highly influenced by python-doc-ja and python-doc-fr's translation architecture and workflow (i.e. a shameless copy). We truly appreciate their contributions.