Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c8e20f1

Browse files
[po] auto sync
1 parent d6dc165 commit c8e20f1

File tree

3 files changed

+55
-15
lines changed

3 files changed

+55
-15
lines changed

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "81.79%", "updated_at": "2025-05-22T06:57:43Z"}
1+
{"translation": "81.81%", "updated_at": "2025-05-23T01:19:48Z"}

library/threading.po

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,19 @@ msgid ""
6161
"bound, such as file operations or making network requests, where much of the"
6262
" time is spent waiting for external resources."
6363
msgstr ""
64+
":mod:`!threading` 模块提供了一种在单个进程内部并发地运行多个 `线程 "
65+
"<https://en.wikipedia.org/wiki/Thread_(computing)>`_ (从进程分出的更小单位) 的方式。 "
66+
"它允许创建和管理线程,以便能够平行地执行多个任务,并共享内存空间。 线程特别适用于 I/O "
67+
"密集型的任务,如文件操作或发送网络请求,在此类任务中大部分时间都会消耗于等待外部资源。"
6468

6569
#: ../../library/threading.rst:27
6670
msgid ""
6771
"A typical use case for :mod:`!threading` includes managing a pool of worker "
6872
"threads that can process multiple tasks concurrently. Here's a basic "
6973
"example of creating and starting threads using :class:`~threading.Thread`::"
7074
msgstr ""
75+
"典型的 :mod:`!threading` 使用场景包括管理一个工作线程池来并发地处理多个任务。 下面是一个使用 "
76+
":class:`~threading.Thread` 创建并启动线程的简单示例::"
7177

7278
#: ../../library/threading.rst:31
7379
msgid ""
@@ -100,6 +106,34 @@ msgid ""
100106
"for t in threads:\n"
101107
" t.join()"
102108
msgstr ""
109+
"import threading\n"
110+
"import time\n"
111+
"\n"
112+
"def crawl(link, delay=3):\n"
113+
" print(f\"crawl started for {link}\")\n"
114+
" time.sleep(delay) # 阻塞 I/O (模拟网络请求)\n"
115+
" print(f\"crawl ended for {link}\")\n"
116+
"\n"
117+
"links = [\n"
118+
" \"https://python.org\",\n"
119+
" \"https://docs.python.org\",\n"
120+
" \"https://peps.python.org\",\n"
121+
"]\n"
122+
"\n"
123+
"# 针对每个链接启动线程\n"
124+
"threads = []\n"
125+
"for link in links:\n"
126+
" # 使用 `args` 传入位置参数并使用 `kwargs` 传入关键字参数\n"
127+
" t = threading.Thread(target=crawl, args=(link,), kwargs={\"delay\": 2})\n"
128+
" threads.append(t)\n"
129+
"\n"
130+
"# 启动每个线程\n"
131+
"for t in threads:\n"
132+
" t.start()\n"
133+
"\n"
134+
"# 等待所有线程结束\n"
135+
"for t in threads:\n"
136+
" t.join()"
103137

104138
#: ../../library/threading.rst:60
105139
msgid "This module used to be optional, it is now always available."
@@ -166,13 +200,18 @@ msgid ""
166200
"bytecode at a time. Despite this, threads remain a useful tool for achieving"
167201
" concurrency in many scenarios."
168202
msgstr ""
203+
"与使用多个进程来绕过 :term:`global interpreter lock` (GIL) 的 :mod:`multiprocessing` "
204+
"模块不同,threading 模块是在单个进程内部操作的,这意味着所有线程共享相同的内存空间。 不过,对于 CPU 密集型任务来说 GIL 会限制 "
205+
"threading 带来的性能提升,因为在同一时刻只有一个线程能执行 Python 字节码。 尽管如此,在许多场景中线程仍然是实现并发的有用工具。"
169206

170207
#: ../../library/threading.rst:105
171208
msgid ""
172209
"As of Python 3.13, experimental :term:`free-threaded <free threading>` "
173210
"builds can disable the GIL, enabling true parallel execution of threads, but"
174211
" this feature is not available by default (see :pep:`703`)."
175212
msgstr ""
213+
"对于 Python 3.13,实验性的 :term:`自由线程 <free threading>` 构建版可以禁用 "
214+
"GIL,启用真正的线程并行执行,但此特性在默认情况下不可用 (参见 :pep:`703`)。"
176215

177216
#: ../../library/threading.rst:112
178217
msgid "Reference"
@@ -199,6 +238,8 @@ msgid ""
199238
"through the :mod:`!threading` module, a dummy thread object with limited "
200239
"functionality is returned."
201240
msgstr ""
241+
"返回当前 :class:`Thread` 对象,与调用方的控制线程。 如果调用方的控制线程不是通过 :mod:`!threading` "
242+
"模块创建的,则会返回一个功能受限的假线程对象。"
202243

203244
#: ../../library/threading.rst:132
204245
msgid ""
@@ -325,12 +366,14 @@ msgid ""
325366
"module. The *func* will be passed to :func:`sys.settrace` for each thread, "
326367
"before its :meth:`~Thread.run` method is called."
327368
msgstr ""
369+
"为所有从 :mod:`!threading` 模块启动的线程设置追踪函数,在每个线程的 :meth:`~Thread.run` "
370+
"方法被调用前,*func* 会被传递给 :func:`sys.settrace`。"
328371

329372
#: ../../library/threading.rst:230
330373
msgid ""
331374
"Set a trace function for all threads started from the :mod:`!threading` "
332375
"module and all Python threads that are currently executing."
333-
msgstr ""
376+
msgstr "为从 :mod:`!threading` 模块启动的所有线程以及当前正在执行的所有 Python 线程设置追踪函数。"
334377

335378
#: ../../library/threading.rst:233
336379
msgid ""
@@ -349,12 +392,14 @@ msgid ""
349392
"module. The *func* will be passed to :func:`sys.setprofile` for each "
350393
"thread, before its :meth:`~Thread.run` method is called."
351394
msgstr ""
395+
"为从 :mod:`!threading` 模块启动的所有线程设置性能分析函数。 在每个线程的 :meth:`~Thread.run` "
396+
"方法被调用前,*func* 会被传递给 :func:`sys.setprofile`。"
352397

353398
#: ../../library/threading.rst:259
354399
msgid ""
355400
"Set a profile function for all threads started from the :mod:`!threading` "
356401
"module and all Python threads that are currently executing."
357-
msgstr ""
402+
msgstr "为从 :mod:`!threading` 模块启动的所有线程和当前正在执行和的所有 Python 线程设置性能分析函数。"
358403

359404
#: ../../library/threading.rst:262
360405
msgid ""
@@ -709,7 +754,7 @@ msgstr "一个代表线程本地数据的类。"
709754

710755
#: ../../library/threading.rst:457
711756
msgid "Thread objects"
712-
msgstr "Thread 对象"
757+
msgstr "线程对象"
713758

714759
#: ../../library/threading.rst:459
715760
msgid ""
@@ -1058,7 +1103,7 @@ msgstr "已被弃用的 :attr:`~Thread.daemon` 的取值/设值 API;请改为
10581103

10591104
#: ../../library/threading.rst:676
10601105
msgid "Lock objects"
1061-
msgstr "Lock 对象"
1106+
msgstr "锁对象"
10621107

10631108
#: ../../library/threading.rst:678
10641109
msgid ""

whatsnew/3.3.po

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
# SOME DESCRIPTIVE TITLE.
2-
# Copyright (C) 2001 Python Software Foundation
2+
# Copyright (C) 2001-2025, Python Software Foundation
33
# This file is distributed under the same license as the Python package.
44
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55
#
66
# Translators:
7-
# sgqy <[email protected]>, 2021
8-
# jacky <[email protected]>, 2021
9-
# Kaizhao Zhang <[email protected]>, 2021
10-
# ppcfish <[email protected]>, 2021
11-
# Dai Xu <[email protected]>, 2021
12-
# Rafael Fontenelle <[email protected]>, 2024
7+
# Rafael Fontenelle <[email protected]>, 2025
138
# Freesand Leo <[email protected]>, 2025
149
#
1510
#, fuzzy
1611
msgid ""
1712
msgstr ""
18-
"Project-Id-Version: Python 3.14\n"
13+
"Project-Id-Version: Python 3.13\n"
1914
"Report-Msgid-Bugs-To: \n"
20-
"POT-Creation-Date: 2025-05-08 02:53-0300\n"
21-
"PO-Revision-Date: 2021-06-29 13:04+0000\n"
15+
"POT-Creation-Date: 2025-05-16 14:58+0000\n"
16+
"PO-Revision-Date: 2025-05-08 05:10+0000\n"
2217
"Last-Translator: Freesand Leo <[email protected]>, 2025\n"
2318
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2419
"MIME-Version: 1.0\n"

0 commit comments

Comments
 (0)