Skip to content
Prev Previous commit
Next Next commit
Translate core sys module sections: path, version, exit functions
Co-authored-by: josix <[email protected]>
  • Loading branch information
Copilot and josix committed Jul 12, 2025
commit c38ff75cf4950087e9fbb94f69bfa8f8052a403a
15 changes: 15 additions & 0 deletions library/sys.po
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ msgid ""
"Raise a :exc:`SystemExit` exception, signaling an intention to exit the "
"interpreter."
msgstr ""
"引發 :exc:`SystemExit` 例外,表示意圖退出直譯器。"

#: ../../library/sys.rst:504
msgid ""
Expand All @@ -641,6 +642,7 @@ msgid ""
"code of 1. In particular, ``sys.exit(\"some error message\")`` is a quick "
"way to exit a program when an error occurs."
msgstr ""
"選擇性引數 *arg* 可以是給出退出狀態的整數(預設為零),或其他型別的物件。如果它是整數,零被 shell 等視為「成功終止」,任何非零值被視為「異常終止」。大多數系統要求它在 0-127 範圍內,否則會產生未定義的結果。某些系統有將特定含義分配給特定退出代碼的慣例,但這些通常不太成熟;Unix 程式通常使用 2 來表示命令列語法錯誤,使用 1 來表示所有其他類型的錯誤。如果傳遞了其他型別的物件,``None`` 等同於傳遞零,任何其他物件會被列印到 :data:`stderr` 並導致退出代碼為 1。特別是,``sys.exit(\"some error message\")`` 是在發生錯誤時退出程式的快速方法。"

#: ../../library/sys.rst:517
msgid ""
Expand All @@ -650,6 +652,7 @@ msgid ""
"statements are honored, and it is possible to intercept the exit attempt at "
"an outer level."
msgstr ""
"由於 :func:`exit` 最終「只是」引發例外,它只有在從主執行緒呼叫且例外未被攔截時才會退出程序。:keyword:`try` 陳述式的 finally 子句中指定的清理動作會被執行,並且可以在外層攔截退出嘗試。"

#: ../../library/sys.rst:522
msgid ""
Expand Down Expand Up @@ -1687,56 +1690,65 @@ msgid ""
"user's program. Arguments consumed by the interpreter itself will be present "
"in :data:`sys.orig_argv` and missing from :data:`sys.argv`."
msgstr ""
":data:`sys.orig_argv` 的元素是 Python 直譯器的引數,而 :data:`sys.argv` 的元素是使用者程式的引數。被直譯器本身消耗的引數會出現在 :data:`sys.orig_argv` 中,但在 :data:`sys.argv` 中會缺失。"

#: ../../library/sys.rst:1366
msgid ""
"A list of strings that specifies the search path for modules. Initialized "
"from the environment variable :envvar:`PYTHONPATH`, plus an installation-"
"dependent default."
msgstr ""
"指定模組搜尋路徑的字串清單。從環境變數 :envvar:`PYTHONPATH` 初始化,加上依賴安裝的預設值。"

#: ../../library/sys.rst:1370
msgid ""
"By default, as initialized upon program startup, a potentially unsafe path "
"is prepended to :data:`sys.path` (*before* the entries inserted as a result "
"of :envvar:`PYTHONPATH`):"
msgstr ""
"預設情況下,在程式啟動時初始化時,會將一個可能不安全的路徑前置到 :data:`sys.path`(在由於 :envvar:`PYTHONPATH` 而插入的條目*之前*):"

#: ../../library/sys.rst:1374
msgid ""
"``python -m module`` command line: prepend the current working directory."
msgstr ""
"``python -m module`` 命令列:前置目前工作目錄。"

#: ../../library/sys.rst:1376
msgid ""
"``python script.py`` command line: prepend the script's directory. If it's a "
"symbolic link, resolve symbolic links."
msgstr ""
"``python script.py`` 命令列:前置指令碼的目錄。如果它是符號連結,則解析符號連結。"

#: ../../library/sys.rst:1378
msgid ""
"``python -c code`` and ``python`` (REPL) command lines: prepend an empty "
"string, which means the current working directory."
msgstr ""
"``python -c code`` 和 ``python``(REPL)命令列:前置空字串,這表示目前工作目錄。"

#: ../../library/sys.rst:1381
msgid ""
"To not prepend this potentially unsafe path, use the :option:`-P` command "
"line option or the :envvar:`PYTHONSAFEPATH` environment variable."
msgstr ""
"為了不前置這個可能不安全的路徑,請使用 :option:`-P` 命令列選項或 :envvar:`PYTHONSAFEPATH` 環境變數。"

#: ../../library/sys.rst:1384
msgid ""
"A program is free to modify this list for its own purposes. Only strings "
"should be added to :data:`sys.path`; all other data types are ignored during "
"import."
msgstr ""
"程式可以自由地為自己的目的修改這個清單。只能將字串加入到 :data:`sys.path`;所有其他資料型別在匯入時會被忽略。"

#: ../../library/sys.rst:1390
msgid ""
"Module :mod:`site` This describes how to use .pth files to extend :data:`sys."
"path`."
msgstr ""
"模組 :mod:`site` 這描述了如何使用 .pth 檔案來擴展 :data:`sys.path`。"

#: ../../library/sys.rst:1395
msgid ""
Expand Down Expand Up @@ -2630,12 +2642,14 @@ msgid ""
"version information out of it, rather, use :data:`version_info` and the "
"functions provided by the :mod:`platform` module."
msgstr ""
"包含 Python 直譯器版本號碼以及建置號碼和所使用編譯器的額外資訊的字串。這個字串會在啟動互動式直譯器時顯示。不要從中擷取版本資訊,而是應使用 :data:`version_info` 和 :mod:`platform` 模組提供的函式。"

#: ../../library/sys.rst:2016
msgid ""
"The C API version for this interpreter. Programmers may find this useful "
"when debugging version conflicts between Python and extension modules."
msgstr ""
"此直譯器的 C API 版本。程式設計師在除錯 Python 和擴充模組之間的版本衝突時可能會發現這很有用。"

#: ../../library/sys.rst:2022
msgid ""
Expand All @@ -2647,6 +2661,7 @@ msgid ""
"also be accessed by name, so ``sys.version_info[0]`` is equivalent to ``sys."
"version_info.major`` and so on."
msgstr ""
"包含版本號碼五個組成部分的元組:*major*、*minor*、*micro*、*releaselevel* 和 *serial*。除了 *releaselevel* 以外的所有值都是整數;發布級別是 ``'alpha'``、``'beta'``、``'candidate'`` 或 ``'final'``。對應於 Python 版本 2.0 的 ``version_info`` 值是 ``(2, 0, 0, 'final', 0)``。這些組成部分也可以透過名稱存取,所以 ``sys.version_info[0]`` 等同於 ``sys.version_info.major``,以此類推。"

#: ../../library/sys.rst:2030
msgid "Added named component attributes."
Expand Down