From d6ae9204b4a38a80f6f6d83ece1936d8ba0bcd6e Mon Sep 17 00:00:00 2001 From: lamentxu <1372449351@qq.com> Date: Mon, 7 Jul 2025 23:42:08 +0800 Subject: [PATCH 1/4] trans --- library/linecache.po | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/library/linecache.po b/library/linecache.po index 167947f2539..16862a96f04 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2018-05-23 16:05+0000\n" +"PO-Revision-Date: 2025-07-07 23:41+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,6 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.6\n" #: ../../library/linecache.rst:2 msgid ":mod:`!linecache` --- Random access to text lines" @@ -30,10 +31,14 @@ msgstr "**原始碼:**\\ :source:`Lib/linecache.py`" msgid "" "The :mod:`linecache` module allows one to get any line from a Python source " "file, while attempting to optimize internally, using a cache, the common " -"case where many lines are read from a single file. This is used by the :mod:" -"`traceback` module to retrieve source lines for inclusion in the formatted " -"traceback." +"case where many lines are read from a single file. This is used by " +"the :mod:`traceback` module to retrieve source lines for inclusion in the " +"formatted traceback." msgstr "" +":mod:`linecache` 模組允許從 Python 原始碼檔案中取得任何一行。儅嘗試在程式内部" +"進行優化,會使用緩存,這是從單一檔案讀取許多行的常見情況。 這" +"被 :mod:`traceback` 模組用來擷取來自原始碼檔案的行,以包含在格式化的 " +"traceback 中。" #: ../../library/linecache.rst:18 msgid "" @@ -41,10 +46,13 @@ msgid "" "uses :func:`tokenize.detect_encoding` to get the encoding of the file; in " "the absence of an encoding token, the file encoding defaults to UTF-8." msgstr "" +":func:`tokenize.open` 函式用來開啟檔案。這個函式使" +"用 :func:`tokenize.detect_encoding` 來取得檔案的編碼;在沒有編碼標記的情況" +"下,檔案編碼預設為 UTF-8。" #: ../../library/linecache.rst:22 msgid "The :mod:`linecache` module defines the following functions:" -msgstr "" +msgstr ":mod:`linecache` 模組定義了下列函式:" #: ../../library/linecache.rst:27 msgid "" @@ -52,22 +60,31 @@ msgid "" "an exception --- it will return ``''`` on errors (the terminating newline " "character will be included for lines that are found)." msgstr "" +"從名為 *filename* 的檔案中取得 *lineno* 行。這個函式不會產生異常 --- 它會在出" +"錯時返回 ``''``(找到的行會包含終止換行符號)。" #: ../../library/linecache.rst:33 msgid "" -"If a file named *filename* is not found, the function first checks for a :" -"pep:`302` ``__loader__`` in *module_globals*. If there is such a loader and " -"it defines a ``get_source`` method, then that determines the source lines " -"(if ``get_source()`` returns ``None``, then ``''`` is returned). Finally, if " -"*filename* is a relative filename, it is looked up relative to the entries " -"in the module search path, ``sys.path``." +"If a file named *filename* is not found, the function first checks for " +"a :pep:`302` ``__loader__`` in *module_globals*. If there is such a loader " +"and it defines a ``get_source`` method, then that determines the source " +"lines (if ``get_source()`` returns ``None``, then ``''`` is returned). " +"Finally, if *filename* is a relative filename, it is looked up relative to " +"the entries in the module search path, ``sys.path``." msgstr "" +"如果找不到名為 *filename* 的檔案,函式會先檢查 *module_globals* 中是否" +"有 :pep:`302``__loader__` 裝載器。如果有這樣一個載入器,而且它定義了一個 " +"``get_source`` 方法,這之後它就會決定原始碼行 (如果 ``get_source()`` 返回 " +"``None``,那麼就會返回 ``''``)。最後,如果 *filename* 是相對的檔案名稱,則會" +"相對於模組搜尋路徑 ``sys.path`` 中的項目進行搜尋。" #: ../../library/linecache.rst:44 msgid "" "Clear the cache. Use this function if you no longer need lines from files " "previously read using :func:`getline`." msgstr "" +"清除緩存。 如果您不再需要先前使用 :func:`getline` 讀取的檔案行數,請使用此函" +"式。" #: ../../library/linecache.rst:50 msgid "" @@ -75,6 +92,8 @@ msgid "" "have changed on disk, and you require the updated version. If *filename* is " "omitted, it will check all the entries in the cache." msgstr "" +"檢查緩存是否有效。 如果緩存中的檔案可能已在磁碟上變更,而您需要更新的版本,請" +"使用此功能。 如果省略 *filename*,則會檢查緩存中的所有項目。" #: ../../library/linecache.rst:56 msgid "" @@ -83,6 +102,9 @@ msgid "" "later call. This avoids doing I/O until a line is actually needed, without " "having to carry the module globals around indefinitely." msgstr "" +"即使 *module_globals* 在稍後的呼叫中是 ``None`` ,也可以擷取非檔案型模組的足" +"夠細節,以允許稍後透過 :func:`getline` 取得其行。這可以避免在真正需要某一行之" +"前進行 I/O 操作,而不必無限期地帶著模塊的全局變量。" #: ../../library/linecache.rst:63 msgid "Example::" From b513b87fa5981367d069ab43089c3b66890db5cd Mon Sep 17 00:00:00 2001 From: lamentxu <1372449351@qq.com> Date: Mon, 7 Jul 2025 23:45:04 +0800 Subject: [PATCH 2/4] Update linecache.po --- library/linecache.po | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/linecache.po b/library/linecache.po index 16862a96f04..337f2808b0a 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -3,13 +3,14 @@ # This file is distributed under the same license as the Python package. # # Translators: +# Weilin Du, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2025-07-07 23:41+0800\n" -"Last-Translator: Adrian Liaw \n" +"Last-Translator: Weilin Du <1372449351@qq.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" From d63502f53bd80311e4abe2aef5ebc976e4094117 Mon Sep 17 00:00:00 2001 From: lamentxu <1372449351@qq.com> Date: Mon, 7 Jul 2025 23:50:04 +0800 Subject: [PATCH 3/4] Update linecache.po --- library/linecache.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/linecache.po b/library/linecache.po index 337f2808b0a..7866538ef9d 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2025-07-07 23:41+0800\n" +"PO-Revision-Date: 2025-07-07 23:50+0800\n" "Last-Translator: Weilin Du <1372449351@qq.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -62,7 +62,7 @@ msgid "" "character will be included for lines that are found)." msgstr "" "從名為 *filename* 的檔案中取得 *lineno* 行。這個函式不會產生異常 --- 它會在出" -"錯時返回 ``''``(找到的行會包含終止換行符號)。" +"錯時返回 ``''`` (找到的行會包含終止換行符號)。" #: ../../library/linecache.rst:33 msgid "" @@ -74,7 +74,7 @@ msgid "" "the entries in the module search path, ``sys.path``." msgstr "" "如果找不到名為 *filename* 的檔案,函式會先檢查 *module_globals* 中是否" -"有 :pep:`302``__loader__` 裝載器。如果有這樣一個載入器,而且它定義了一個 " +"有 :pep:`302` `__loader__` 裝載器。如果有這樣一個載入器,而且它定義了一個 " "``get_source`` 方法,這之後它就會決定原始碼行 (如果 ``get_source()`` 返回 " "``None``,那麼就會返回 ``''``)。最後,如果 *filename* 是相對的檔案名稱,則會" "相對於模組搜尋路徑 ``sys.path`` 中的項目進行搜尋。" From 9364f91762d3d28b96a6eb1436258a4f9f69e2c2 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:30:12 +0800 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: W. H. Wang --- library/linecache.po | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/library/linecache.po b/library/linecache.po index 7866538ef9d..cdb7ae4122d 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -36,8 +36,8 @@ msgid "" "the :mod:`traceback` module to retrieve source lines for inclusion in the " "formatted traceback." msgstr "" -":mod:`linecache` 模組允許從 Python 原始碼檔案中取得任何一行。儅嘗試在程式内部" -"進行優化,會使用緩存,這是從單一檔案讀取許多行的常見情況。 這" +":mod:`linecache` 模組允許從 Python 原始碼檔案中取得任何一行。當嘗試在程式內部" +"進行最佳化,會使用快取,這是從單一檔案讀取許多行的常見情況。 這" "被 :mod:`traceback` 模組用來擷取來自原始碼檔案的行,以包含在格式化的 " "traceback 中。" @@ -61,8 +61,8 @@ msgid "" "an exception --- it will return ``''`` on errors (the terminating newline " "character will be included for lines that are found)." msgstr "" -"從名為 *filename* 的檔案中取得 *lineno* 行。這個函式不會產生異常 --- 它會在出" -"錯時返回 ``''`` (找到的行會包含終止換行符號)。" +"從名為 *filename* 的檔案中取得 *lineno* 行。這個函式不會產生例外 --- 它會在出" +"錯時回傳 ``''`` (找到的行會包含終止換行字元)。" #: ../../library/linecache.rst:33 msgid "" @@ -74,9 +74,9 @@ msgid "" "the entries in the module search path, ``sys.path``." msgstr "" "如果找不到名為 *filename* 的檔案,函式會先檢查 *module_globals* 中是否" -"有 :pep:`302` `__loader__` 裝載器。如果有這樣一個載入器,而且它定義了一個 " -"``get_source`` 方法,這之後它就會決定原始碼行 (如果 ``get_source()`` 返回 " -"``None``,那麼就會返回 ``''``)。最後,如果 *filename* 是相對的檔案名稱,則會" +"有 :pep:`302` `__loader__` 載入器。如果有這樣一個載入器,而且它定義了一個 " +"``get_source`` 方法,這之後它就會決定原始碼行(如果 ``get_source()`` 回傳 " +"``None``,那麼就會回傳 ``''``)。最後,如果 *filename* 是相對的檔案名稱,則會" "相對於模組搜尋路徑 ``sys.path`` 中的項目進行搜尋。" #: ../../library/linecache.rst:44 @@ -84,7 +84,7 @@ msgid "" "Clear the cache. Use this function if you no longer need lines from files " "previously read using :func:`getline`." msgstr "" -"清除緩存。 如果您不再需要先前使用 :func:`getline` 讀取的檔案行數,請使用此函" +"清除快取。如果你不再需要先前使用 :func:`getline` 讀取的檔案行數,請使用此函" "式。" #: ../../library/linecache.rst:50 @@ -93,8 +93,8 @@ msgid "" "have changed on disk, and you require the updated version. If *filename* is " "omitted, it will check all the entries in the cache." msgstr "" -"檢查緩存是否有效。 如果緩存中的檔案可能已在磁碟上變更,而您需要更新的版本,請" -"使用此功能。 如果省略 *filename*,則會檢查緩存中的所有項目。" +"檢查快取是否有效。如果快取中的檔案可能已在磁碟上變更,而你需要更新的版本,請" +"使用此功能。 如果省略 *filename*,則會檢查快取中的所有項目。" #: ../../library/linecache.rst:56 msgid "" @@ -105,7 +105,7 @@ msgid "" msgstr "" "即使 *module_globals* 在稍後的呼叫中是 ``None`` ,也可以擷取非檔案型模組的足" "夠細節,以允許稍後透過 :func:`getline` 取得其行。這可以避免在真正需要某一行之" -"前進行 I/O 操作,而不必無限期地帶著模塊的全局變量。" +"前進行 I/O 操作,而不必無限期地帶著模組的全域變數。" #: ../../library/linecache.rst:63 msgid "Example::"