Skip to content

Commit af83098

Browse files
committed
fix: to rst: 480
- 需確認 boilerplate 是否需翻譯
1 parent 7823bb1 commit af83098

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

reference/import.po

+39-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgstr ""
77
"Project-Id-Version: Python 3.13\n"
88
"Report-Msgid-Bugs-To: \n"
99
"POT-Creation-Date: 2024-09-03 11:11+0800\n"
10-
"PO-Revision-Date: 2024-10-08 15:45+0800\n"
10+
"PO-Revision-Date: 2024-10-29 01:29+0800\n"
1111
"Last-Translator: Ken Cheng <ken71301@gmail.com>\n"
1212
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1313
"tw)\n"
@@ -745,7 +745,7 @@ msgstr ""
745745

746746
#: ../../reference/import.rst:412
747747
msgid "Loaders"
748-
msgstr ""
748+
msgstr "載入器"
749749

750750
#: ../../reference/import.rst:414
751751
msgid ""
@@ -754,31 +754,41 @@ msgid ""
754754
"method with a single argument, the module object to execute. Any value "
755755
"returned from :meth:`~importlib.abc.Loader.exec_module` is ignored."
756756
msgstr ""
757+
"模組載入器提供了載入的關鍵功能:模組執行。引入機制會以單一引數(即要執行的模"
758+
"組物件)呼叫 :meth:`importlib.abc.Loader.exec_module` 方法。任何從 :meth:"
759+
"`~importlib.abc.Loader.exec_module` 回傳的值都會被忽略。"
757760

758761
#: ../../reference/import.rst:419
759762
msgid "Loaders must satisfy the following requirements:"
760-
msgstr ""
763+
msgstr "載入器必須滿足以下要求:"
761764

762765
#: ../../reference/import.rst:421
763766
msgid ""
764767
"If the module is a Python module (as opposed to a built-in module or a "
765768
"dynamically loaded extension), the loader should execute the module's code "
766769
"in the module's global name space (``module.__dict__``)."
767770
msgstr ""
771+
"如果模組是 Python 模組(而非內建模組或動態載入的擴充),載入器應在模組的全域"
772+
"命名空間 (``module.__dict__``\\ ) 中執行該模組的程式碼。"
768773

769774
#: ../../reference/import.rst:425
770775
msgid ""
771776
"If the loader cannot execute the module, it should raise an :exc:"
772777
"`ImportError`, although any other exception raised during :meth:`~importlib."
773778
"abc.Loader.exec_module` will be propagated."
774779
msgstr ""
780+
"如果載入器無法執行該模組,應引發 :exc:`ImportError`。不過,在 :meth:"
781+
"`~importlib.abc.Loader.exec_module` 中引發的任何其他例外也會被傳播。"
775782

776783
#: ../../reference/import.rst:429
777784
msgid ""
778785
"In many cases, the finder and loader can be the same object; in such cases "
779786
"the :meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return "
780787
"a spec with the loader set to ``self``."
781788
msgstr ""
789+
"在許多情況下,尋檢器和載入器可以是同一個物件;在這種情況下,:meth:"
790+
"`~importlib.abc.MetaPathFinder.find_spec` 方法只需回傳一個載入器設為 "
791+
"``self`` 的規格即可。"
782792

783793
#: ../../reference/import.rst:433
784794
msgid ""
@@ -789,17 +799,23 @@ msgid ""
789799
"the module object. If the method returns ``None``, the import machinery "
790800
"will create the new module itself."
791801
msgstr ""
802+
"模組載入器可以選擇透過實作 :meth:`~importlib.abc.Loader.create_module` 方法,"
803+
"在載入過程中建立模組物件。該方法接受一個引數,即模組規格,並回傳在載入過程中"
804+
"要使用的新的模組物件。``create_module()`` 不需要在模組物件上設定任何屬性。如"
805+
"果該方法回傳 ``None``,引入機制將自行建立新的模組。"
792806

793807
#: ../../reference/import.rst:440
794808
msgid "The :meth:`~importlib.abc.Loader.create_module` method of loaders."
795-
msgstr ""
809+
msgstr "載入器的 :meth:`~importlib.abc.Loader.create_module` 方法。"
796810

797811
#: ../../reference/import.rst:443
798812
msgid ""
799813
"The :meth:`~importlib.abc.Loader.load_module` method was replaced by :meth:"
800814
"`~importlib.abc.Loader.exec_module` and the import machinery assumed all the "
801815
"boilerplate responsibilities of loading."
802816
msgstr ""
817+
":meth:`~importlib.abc.Loader.load_module` 方法已被 :meth:`~importlib.abc."
818+
"Loader.exec_module` 取代,引入機制已承擔所有載入的功能。"
803819

804820
#: ../../reference/import.rst:448
805821
msgid ""
@@ -808,13 +824,18 @@ msgid ""
808824
"also implement ``exec_module()``. However, ``load_module()`` has been "
809825
"deprecated and loaders should implement ``exec_module()`` instead."
810826
msgstr ""
827+
"為了與現有的載入器相容,引入機制會在載入器未實作 ``exec_module()`` 且存在 "
828+
"``load_module()`` 方法時使用該方法。然而,``load_module()`` 已被棄用,載入器"
829+
"應改為實作 ``exec_module()``。"
811830

812831
#: ../../reference/import.rst:453
813832
msgid ""
814833
"The ``load_module()`` method must implement all the boilerplate loading "
815834
"functionality described above in addition to executing the module. All the "
816835
"same constraints apply, with some additional clarification:"
817836
msgstr ""
837+
"``load_module()`` 方法除了執行模組外,還必須實作上述全部的模板載入功能。所有"
838+
"相同的限制依然適用,並且還有一些額外的說明:"
818839

819840
#: ../../reference/import.rst:457
820841
msgid ""
@@ -824,35 +845,48 @@ msgid ""
824845
"exist in :data:`sys.modules`, the loader must create a new module object and "
825846
"add it to :data:`sys.modules`."
826847
msgstr ""
848+
"如果 :data:`sys.modules` 中已存在具有給定名稱的模組物件,載入器必須使用該模組"
849+
"(否則 :func:`importlib.reload` 將無法正常運作)。如果命名模組不存在於 :data:"
850+
"`sys.modules` 中,載入器必須建立一個新的模組物件並將其新增至 :data:`sys."
851+
"modules`。"
827852

828853
#: ../../reference/import.rst:463
829854
msgid ""
830855
"The module *must* exist in :data:`sys.modules` before the loader executes "
831856
"the module code, to prevent unbounded recursion or multiple loading."
832857
msgstr ""
858+
"在載入器執行模組程式碼之前,該模組\\ *必須*\\ 已存在於 :data:`sys.modules` "
859+
"中,以防止無限遞迴或多次載入。"
833860

834861
#: ../../reference/import.rst:467
835862
msgid ""
836863
"If loading fails, the loader must remove any modules it has inserted into :"
837864
"data:`sys.modules`, but it must remove **only** the failing module(s), and "
838865
"only if the loader itself has loaded the module(s) explicitly."
839866
msgstr ""
867+
"如果載入失敗,載入器必須移除已經插入到 :data:`sys.modules` 中的任何模組,但"
868+
"\\ **只能**\\ 移除失敗的模組(們),且僅在載入器本身明確載入這些模組時才需移"
869+
"除。"
840870

841871
#: ../../reference/import.rst:472
842872
msgid ""
843873
"A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but "
844874
"``create_module()`` is not."
845875
msgstr ""
876+
"當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:"
877+
"`DeprecationWarning`。"
846878

847879
#: ../../reference/import.rst:476
848880
msgid ""
849881
"An :exc:`ImportError` is raised when ``exec_module()`` is defined but "
850882
"``create_module()`` is not."
851883
msgstr ""
884+
"當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:"
885+
"`ImportError`。"
852886

853887
#: ../../reference/import.rst:480
854888
msgid "Use of ``load_module()`` will raise :exc:`ImportWarning`."
855-
msgstr ""
889+
msgstr "使用 ``load_module()`` 將引發 :exc:`ImportWarning`。"
856890

857891
#: ../../reference/import.rst:484
858892
msgid "Submodules"

0 commit comments

Comments
 (0)