8000 Update Translation of ``library/__main__.po`` by rockleona · Pull Request #767 · python/python-docs-zh-tw · GitHub
[go: up one dir, main page]

Skip to content

Update Translation of library/__main__.po #767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 29, 2023
Merged

Conversation

rockleona
Copy link
Collaborator
@rockleona rockleona commented Dec 21, 2023
暴雷內容

image

@rockleona rockleona changed the title Update Translation of __main__ Update Translation of library/__main__.po Dec 21, 2023
@mattwang44 mattwang44 requested a review from mindihx December 21, 2023 09:05
@mattwang44
Copy link
Collaborator

@mindihx 想請你幫忙 review 🙏🏽

Copy link
Collaborator
@mindihx mindihx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看到 line 272 先存檔,明天再看XD => 已看完

@@ -45,6 +47,9 @@ msgid ""
"detail below. If you're new to Python modules, see the tutorial section :"
"ref:`tut-modules` for an introduction."
msgstr ""
"這兩種機制都與 Python 模組有關;使用者如何與他們互動以及他們如何彼此互動。下"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

他們要用它們

@@ -45,6 +47,9 @@ msgid ""
"detail below. If you're new to Python modules, see the tutorial section :"
"ref:`tut-modules` for an introduction."
msgstr ""
"這兩種機制都與 Python 模組有關;使用者如何與他們互動以及他們如何彼此互動。下"
"面詳細解釋它們。如果你不熟悉 Python 模組,請參閱教學部分 :ref:`tut-modules` "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"面詳細解釋它們。如果你不熟悉 Python 模組,請參閱教學部分 :ref:`tut-modules` "
"面會詳細解釋它們。如果你不熟悉 Python 模組,請參閱教學章節 :ref:`tut-modules` "

@@ -81,39 +92,42 @@ msgid ""
"program needs. Sometimes \"top-level code\" is called an *entry point* to "
"the application."
msgstr ""
"``__main__`` 是運行頂層程式碼的環境名稱。「頂層程式碼」是使用者指定的,且第一"
"個開始運作的 Python 模組。它是「頂層」的原因是因為它引入程式所需的所有其他模"
"組。有時「頂層程式碼」被稱為應用程式的「入口點」。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要跟原文一樣用 ** 包起來就好嗎

Suggested change
"組。有時「頂層程式碼」被稱為應用程式的入口點"
"組。有時「頂層程式碼」被稱為應用程式的\\ *入口點*"

@@ -81,39 +92,42 @@ msgid ""
"program needs. Sometimes \"top-level code\" is called an *entry point* to "
"the application."
msgstr ""
"``__main__`` 是運行頂層程式碼的環境名稱。「頂層程式碼」是使用者指定的,且第一"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可能可以把拿掉,這樣比較可以把 "使用者指定的" 跟 "Python 模組" 想在一起
「頂層程式碼」是使用者指定且第一個開始運作的 Python 模組


#: ../../library/__main__.rst:97
msgid ""
"In each of these situations, the top-level module's ``__name__`` is set to "
"``'__main__'``."
msgstr ""
msgstr "在每種情況下,頂層模組的 ``__name__`` 都會設定為 ``'__main__'``。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
msgstr "在每種情況下,頂層模組的 ``__name__`` 都會設定為 ``'__main__'``。"
msgstr "在這些情況下,頂層模組的 ``__name__`` 都會設定為 ``'__main__'``。"

@@ -192,6 +229,9 @@ msgid ""
"`sys.exit`; typically, an integer or ``None`` (which is implicitly returned "
"if your function does not have a return statement)."
msgstr ""
"由於對 ``main`` 的呼叫包含在 :func:`sys.exit` 中,因此期望你的函式將傳回一些"
"可接受的值作為 :func:`sys.exit` 的輸入;通常來說,會是一個整數或 \\ "
"``None``\\(如果你的函式沒有 return 語句,則隱性回傳)。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不確定這樣會不會比較清楚括號裡面的值是針對 None (還有 implicitly 好難翻...乾脆不管它(?))

Suggested change
"``None``\\(如果你的函式沒有 return 語句,則隱性回傳)。"
"``None``\\(如果你的函式沒有 return 陳述式,則相當於回傳此值)。"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我可能還是會保留「隱性」的翻譯,在 library/typing 中我也有翻譯到這個詞,
同時也會出現反義詞「顯性」,所以我認為有保留的必要性,

最終我會修改成這樣:

Suggested change
"``None``\\(如果你的函式沒有 return 語句,則隱性回傳)。"
"``None``\\(如果你的函式沒有 return 陳述式,則相當於隱性回傳此值)。"

@@ -200,6 +240,9 @@ msgid ""
"we later package it as a console script entry-point in a pip-installable "
"package."
msgstr ""
"透過我們自己主動遵循這個常規,我們的模組在直接運行時將具有相同的行為(即 "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convention 翻慣例會比較好嗎
然後括號要不要放在前面一點
直接運行時 (即 ``python echo.py``)將具有相同的行為

@@ -200,6 +240,9 @@ msgid ""
"we later package it as a console script entry-point in a pip-installable "
"package."
msgstr ""
"透過我們自己主動遵循這個常規,我們的模組在直接運行時將具有相同的行為(即 "
"``python echo.py``),就像我們稍後將其打包為控制台腳本入口點一樣的 pip 可安裝"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這樣如何?
我們的模組在直接運行時的行為,將和我們稍後將其打包為 pip 可安裝套件中的控制台腳本入口點相同。

Comment on lines 256 to 257
"特別是,要小心來自 ``main`` 函式的回傳字串。 :func:`sys.exit` 會將字串引數直"
"譯為失敗訊息,因此你的程式將有一個退出代號 ``1``,表示為失敗,並且該字串將被"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要小心的不是字串而是回傳了字串

Suggested change
"特別是,要小心來自 ``main`` 函式的回傳字串。 :func:`sys.exit` 會將字串引數直"
"譯為失敗訊息,因此你的程式將有一個退出代號 ``1``,表示為失敗,並且該字串將被"
"特別是,要謹慎處理從 ``main`` 函式回傳字串。\\ :func:`sys.exit` 會將字串引數直"
"譯為失敗訊息,因此你的程式將有一個表示失敗的結束代碼 ``1``,並且該字串將被"


#: ../../library/__main__.rst:193
msgid ""
"`Python Packaging User Guide <https://packaging.python.org/>`_ contains a "
"collection of tutorials and references on how to distribute and install "
"Python packages with modern tools."
msgstr ""
"\\ `Python 打包使用者指南 <https://packaging.python.org/>`_ 包含一系列如何使"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"\\ `Python 打包使用者指南 <https://packaging.python.org/>`_ 包含一系列如何使"
"`Python 打包使用者指南 <https://packaging.python.org/>`_\\ 包含一系列如何使"

@@ -229,12 +278,17 @@ msgid ""
"to provide a command-line interface for a package. Consider the following "
"hypothetical package, \"bandclass\":"
msgstr ""
"如果你不熟悉 Python 套件,請參閱 :ref:`tut-packages` 的教學部分。最常見的是,"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"如果你不熟悉 Python 套件,請參閱 :ref:`tut-packages` 的教學部分。最常見的是,"
"如果你不熟悉 Python 套件,請參閱 :ref:`tut-packages` 的教學章節。最常見的是,"


#: ../../library/__main__.rst:213
msgid ""
"``__main__.py`` will be executed when the package itself is invoked directly "
"from the command line using the :option:`-m` flag. For example:"
msgstr ""
"當使用 :option:`-m` 旗標 (flag) 直接從命令列呼叫套件本身時,將執行 "
"``__main__.py`` 。例如:"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"``__main__.py`` 。例如:"
"``__main__.py``。例如:"

@@ -243,6 +297,8 @@ msgid ""
"this hypothetical case, it might make sense to allow the teacher to search "
"for students::"
msgstr ""
"該命令將導致 ``__main__.py`` 運行。如何利用此機制將取決於你正在編寫的套件的性"
"質,但在這種假設的情況下,允許教師搜尋學生可能是有意義的: ::"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前面是用虛構看這裡要不要一樣

Suggested change
"質,但在這種假設的情況下,允許教師搜尋學生可能是有意義的: ::"
"質,但在這種虛構的情況下,允許教師搜尋學生可能是有意義的: ::"

@@ -259,40 +318,55 @@ msgid ""
"functions to execute from other modules. Those other modules can then be "
"easily unit-tested and are properly reusable."
msgstr ""
"``__main__.py`` 的內容通常不會被 ``if __name__ == '__main__'`` 區塊包圍。相反"
"的,這些文件保持簡短並引入函式以從其他模組執行。那些其他模組就可以輕鬆地進行"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"的,這些文件保持簡短並引入函式以從其他模組執行。那些其他模組就可以輕鬆地進行"
"的,這些檔案保持簡短並引入其他模組的函式來執行。那些其他模組就可以輕鬆地進行"


#: ../../library/__main__.rst:246
msgid ""
"If used, an ``if __name__ == '__main__'`` block will still work as expected "
"for a ``__main__.py`` file within a package, because its ``__name__`` "
"attribute will include the package's path if imported::"
msgstr ""
"如果使用的話,``if __name__ == '__main__'`` 區塊仍將按預期的進行套件中 "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這樣如何~

如果在套件裡面的 ``__main__.py`` 檔案使用 ``if __name__ == '__main__'`` 區塊,它依然會如預期般地運作。
因為當引入套件,其 ``__name__`` 屬性將會包含套件的路徑: ::


#: ../../library/__main__.rst:348
msgid ""
"The Python REPL is another example of a \"top-level environment\", so "
"anything defined in the REPL becomes part of the ``__main__`` scope::"
msgstr ""
"Python REPL 是「頂層環境」的另一個範例,因此 REPL 中定義的任何內容都成為 "
"``__main__`` 範圍的一部分:"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"``__main__`` 範圍的一部分:"
"``__main__`` 作用範圍的一部分: ::"

@@ -333,6 +412,9 @@ msgid ""
"the ``if __name__ == \"__main__\"`` block of the ``start`` module. Why does "
"this work?"
msgstr ""
"請注意,引入 ``__main__`` 並不會在不經意的運行頂層程式碼(意味著執行腳本)時"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這樣?

引入 ``__main__`` 並不會因為不經意地執行放在 ``start`` 模組中 ``if __name__ == \"__main__\"`` 區塊的頂層程式碼(本來是給腳本使用的)而造成任何問題

@@ -346,21 +428,32 @@ msgid ""
"<import-dunder-main>` in the import system's reference for details on how "
"this works."
msgstr ""
"當 Python 直譯器啟動時,在 :data:`sys.modules` 中插入一個空的 ``__main__`` 模"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"當 Python 直譯器啟動時, :data:`sys.modules` 中插入一個空的 ``__main__`` 模"
"當 Python 直譯器啟動時,會在 :data:`sys.modules` 中插入一個空的 ``__main__`` 模"

@@ -346,21 +428,32 @@ msgid ""
"<import-dunder-main>` in the import system's reference for details on how "
"this works."
msgstr ""
"當 Python 直譯器啟動時,在 :data:`sys.modules` 中插入一個空的 ``__main__`` 模"
"組,並透過執行頂層程式碼來填充它。在我們的範例中,這是 ``start`` 模組,它將逐"
"行運行並引入 ``namely``。反過來,``namely`` 引入 ``__main__`` (其實是 "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in turn 在這邊比較像是接下來輪到 namely的意思?

Suggested change
"行運行並引入 ``namely``。反過來,``namely`` 引入 ``__main__`` (其實是 "
"行運行並引入 ``namely``。接著,``namely`` 引入 ``__main__``\\ (其實是 "

"``start``)。這就是一個引入循環!幸運的是,由於部分填充的 ``__main__`` 模組存"
"在於 :data:`sys.modules` 中,Python 將其傳遞給 ``namely``。請參閱引入系統參考"
"文件中的 :ref:`關於 __main__ 的特別考量 <import-dunder-main>` 了解其工作原理"
"的詳細資訊 。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"的詳細資訊 "
"的詳細資訊。"

@rockleona
Copy link
Collaborator Author

感謝 mindi 的 Review,這次用 Google Translate 做的翻譯好像太過於潦草了,
再次感謝你注意那麼多細節QQ

@rockleona rockleona requested a review from mindihx December 25, 2023 06:45
Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
@rockleona rockleona requested a review from mattwang44 December 26, 2023 10:30
mattwang44
mattwang44 previously approved these changes Dec 27, 2023
Copy link
Collaborator
@mattwang44 mattwang44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'll let Mindi to make the final decision

2851
@@ -81,39 +92,42 @@ msgid ""
"program needs. Sometimes \"top-level code\" is called an *entry point* to "
"the application."
msgstr ""
"``__main__`` 是運行頂層程式碼的環境名稱。「頂層程式碼」是使用者指定且第一"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這檔案還有幾個運行,要都改成執行


#: ../../library/__main__.rst:55
msgid "the scope of an interactive prompt::"
msgstr ""
msgstr "互動式提示字元的範圍: ::"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope 要統一翻成作用範圍嗎 (或作用域),現在兩種都有用

Comment on lines 256 to 257
"譯為失敗訊息,因此你的程式將有一個表示失敗的結束代碼 ``1``,表示為失敗,並且該字串將被"
"寫入 :data:`sys.stderr`。前面的 ``echo.py`` 範例使用常規 ``sys."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"譯為失敗訊息,因此你的程式將有一個表示失敗的結束代碼 ``1``,表示為失敗,並且該字串將被"
"寫入 :data:`sys.stderr`。前面的 ``echo.py`` 範例使用常規 ``sys."
"譯為失敗訊息,因此你的程式將有一個表示失敗的結束代碼 ``1``,並且該字串將被"
"寫入 :data:`sys.stderr`。前面的 ``echo.py`` 範例使用慣例的 ``sys."

Comment on lines 310 to 311
"內的模組時,可以使用此引入樣式。有關更多詳細資訊,請參閱教學 :ref:`tut-"
"modules` 中的 :ref:`intra-package-references`。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"內的模組時,可以使用此引入樣式。有關更多詳細資訊,請參閱教學 :ref:`tut-"
"modules` 中的 :ref:`intra-package-references`。"
"內的模組時,可以使用此引入樣式。有關更多詳細資訊,請參閱 :ref:`tut-"
"modules` 教學章節中的 :ref:`intra-package-references`。"

Comment on lines 403 to 404
"程式的結束代碼將為 1,表示出現錯誤。取消註解 ``my_name = \"Dinsdale\"`` 執行"
"修復程式後,現在它以狀態碼 0 退出,表示成功:"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"程式的結束代碼將為 1,表示出現錯誤。取消註解 ``my_name = \"Dinsdale\"`` 執行"
"修復程式後,現在它以狀態碼 0 退出,表示成功:"
"程式的結束代碼將為 1,表示出現錯誤。取消註解 ``my_name = \"Dinsdale\"`` "
"修復程式後,現在它以狀態碼 0 結束,表示成功:"

@@ -333,6 +410,9 @@ msgid ""
"the ``if __name__ == \"__main__\"`` block of the ``start`` module. Why does "
"this work?"
msgstr ""
"請注意,引入 ``__main__`` 並不會因為不經意地執行放在 ``start`` 模組中 "
"``if __name__ == \"__main__\"`` 區塊的頂層程式碼(本來是給腳本使用的)而造成任何問題"
"。為什麼這樣做會如期運作?"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"為什麼這樣做會如期運作"
"為什麼這樣做會如預期運作"


#: ../../library/__main__.rst:364
msgid ""
"Note that in this case the ``__main__`` scope doesn't contain a ``__file__`` "
"attribute as it's interactive."
msgstr ""
"請注意,在這種情況下, ``__main__`` 作用域不包含 ``__file__`` 屬性,因為它是可"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interactive 翻成互動式的會不會比較適合?
它的意思應該是說因為它在 REPL 互動式的環境裡面所以不會有檔案的概念?

@rockleona rockleona merged commit 4114b50 into python:3.12 Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0