Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update Translation oflibrary/__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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
rockleona merged 4 commits intopython:3.12fromrockleona:__main__
Dec 29, 2023

Conversation

@rockleona
Copy link
Collaborator

@rockleonarockleona commentedDec 21, 2023
edited
Loading

暴雷內容

image

@rockleonarockleona changed the titleUpdate Translation of__main__Update Translation oflibrary/__main__.poDec 21, 2023
@mattwang44
Copy link
Collaborator

@mindihx 想請你幫忙 review 🙏🏽

mindihx reacted with eyes emoji

Copy link
Collaborator

@mindihxmindihx left a comment
edited
Loading

Choose a reason for hiding this comment

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

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

"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.

他們要用它們

rockleona reacted with thumbs up emoji
"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`"

rockleona reacted with thumbs up emoji
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
"組。有時「頂層程式碼」被稱為應用程式的入口點"
"組。有時「頂層程式碼」被稱為應用程式的\\ *入口點*"

rockleona reacted with thumbs up emoji
"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 模組

rockleona reacted with thumbs up emoji
"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__'``。"

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
CollaboratorAuthor

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陳述式,則相當於隱性回傳此值)。"

"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``)將具有相同的行為

rockleona reacted with thumbs up emojirockleona reacted with heart emoji
"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 可安裝套件中的控制台腳本入口點相同。

rockleona reacted with thumbs up emoji
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``,並且該字串將被"

"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/>`_\\ 包含一系列如何使"

rockleona reacted with thumbs up emoji
"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`的教學章節。最常見的是,"

rockleona reacted with thumbs up emoji
"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``。例如:"

rockleona reacted with thumbs up emoji
"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
"質,但在這種假設的情況下,允許教師搜尋學生可能是有意義的: ::"
"質,但在這種虛構的情況下,允許教師搜尋學生可能是有意義的: ::"

rockleona reacted with thumbs up emoji
"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
"的,這些文件保持簡短並引入函式以從其他模組執行。那些其他模組就可以輕鬆地進行"
"的,這些檔案保持簡短並引入其他模組的函式來執行。那些其他模組就可以輕鬆地進行"

rockleona reacted with thumbs up emoji
"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__`` 屬性將會包含套件的路徑: ::

"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__``作用範圍的一部分: ::"

"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__\"`` 區塊的頂層程式碼(本來是給腳本使用的)而造成任何問題

rockleona reacted with thumbs up emoji
"<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__`` 模"

rockleona reacted with thumbs up emoji
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
CollaboratorAuthor

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

Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
mattwang44
mattwang44 previously approved these changesDec 27, 2023
Copy link
Collaborator

@mattwang44mattwang44 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

rockleona reacted with heart emojirockleona reacted with rocket emoji
"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.

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

rockleona reacted with heart emoji
#:../../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 要統一翻成作用範圍嗎 (或作用域),現在兩種都有用

rockleona reacted with heart emoji
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."

rockleona reacted with heart emoji
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`。"

rockleona reacted with heart emoji
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結束,表示成功:"

rockleona reacted with heart emoji
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
"為什麼這樣做會如期運作"
"為什麼這樣做會如預期運作"

rockleona reacted with heart emoji
"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 reacted with heart emoji
@rockleonarockleona merged commit4114b50 intopython:3.12Dec 29, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mindihxmindihxmindihx approved these changes

@mattwang44mattwang44mattwang44 left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@rockleona@mattwang44@mindihx

[8]ページ先頭

©2009-2025 Movatter.jp