@@ -5,7 +5,7 @@ msgstr ""
5
5
"Project-Id-Version : Python 3.13\n "
6
6
"Report-Msgid-Bugs-To : \n "
7
7
"POT-Creation-Date : 2024-10-31 00:13+0000\n "
8
- "PO-Revision-Date : 2025-07-13 00:28 +0800\n "
8
+ "PO-Revision-Date : 2025-07-17 20:49 +0800\n "
9
9
"Last-Translator : \n "
10
10
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
11
11
"tw)\n "
@@ -27,9 +27,10 @@ msgid ""
27
27
"the :class:`~contextvars.Context` class should be used to manage the current "
28
28
"context in asynchronous frameworks."
29
29
msgstr ""
30
- "本模組供 API 來管理、儲存及存取 context-local 狀態。 用 :class:`~contextvars."
31
- "ContextVar` 型別宣告和處理 *情境變數*。 :func:`~contextvars.copy_context` 函式"
32
- "和 :class:`~contextvars.Context` 類別來在非同步框架中管理目前的情境。"
30
+ "本模組供 API 來管理、儲存及存取單一情境各自的狀態(context-local state)。 "
31
+ "用 :class:`~contextvars.ContextVar` 型別宣告和處理 *情境變數*。 :func:"
32
+ "`~contextvars.copy_context` 函式和 :class:`~contextvars.Context` 類別來在非同"
33
+ "步框架中管理目前的情境。"
33
34
34
35
#: ../../library/contextvars.rst:17
35
36
msgid ""
@@ -68,8 +69,8 @@ msgid ""
68
69
"`ContextVar.get` when no value for the variable is found in the current "
69
70
"context."
70
71
msgstr ""
71
- "當在目前的情境中找不到變數的值時,:meth:`ContextVar.get` 會回傳 *default* 參數 "
72
- "的值 ,此 *default* 參數只能用關鍵字來定義(關鍵字引數)。"
72
+ "當在目前的情境中找不到變數的值時,:meth:`ContextVar.get` 會回傳 *default* 參 "
73
+ "數的值 ,此 *default* 參數只能用關鍵字來定義(關鍵字引數)。"
73
74
74
75
#: ../../library/contextvars.rst:42
75
76
msgid ""
@@ -78,9 +79,9 @@ msgid ""
78
79
"context variables which prevents context variables from being properly "
79
80
"garbage collected."
80
81
msgstr ""
81
- "**重要:** 情境變數應該在最頂端的模組層級建立,絕對不要在閉包(closure)中建 "
82
- "立 。 :class:`Context` 物件持有情境變數的強參照,這會阻止情境變數被正確地垃圾 "
83
- "回收 (garbage collected)。"
82
+ "**重要:**\\ 情境變數應該在最頂端的模組層級建立,絕對不要在閉包(closure)中 "
83
+ "建立 。 :class:`Context` 物件持有情境變數的強參照,這會阻止情境變數被正確地垃 "
84
+ "圾回收 (garbage collected)。"
84
85
85
86
#: ../../library/contextvars.rst:49
86
87
msgid "The name of the variable. This is a read-only property."
@@ -99,17 +100,17 @@ msgstr "如果在當前情境中沒有變數的值,此方法將:"
99
100
#: ../../library/contextvars.rst:60
100
101
msgid ""
101
102
"return the value of the *default* argument of the method, if provided; or"
102
- msgstr "回傳方法的 *default* 引數值(如果有提供);或 "
103
+ msgstr "回傳方法的 *default* 引數值(如果有的話);否則 "
103
104
104
105
#: ../../library/contextvars.rst:63
105
106
msgid ""
106
107
"return the default value for the context variable, if it was created with "
107
108
"one; or"
108
- msgstr "回傳情境變數的預設值(如果是用情境變量建立的的話);或 "
109
+ msgstr "回傳情境變數的預設值(如果是用情境變量建立的的話);否則 "
109
110
110
111
#: ../../library/contextvars.rst:66
111
112
msgid "raise a :exc:`LookupError`."
112
- msgstr "引發一個 :exc:`LookupError`。"
113
+ msgstr "會引發一個 :exc:`LookupError`。"
113
114
114
115
#: ../../library/contextvars.rst:70
115
116
msgid ""
@@ -126,8 +127,8 @@ msgid ""
126
127
"Returns a :class:`~contextvars.Token` object that can be used to restore the "
127
128
"variable to its previous value via the :meth:`ContextVar.reset` method."
128
129
msgstr ""
129
- "回傳一個 :class:`~contextvars.Token` 物件,可以用來透過 :meth:`ContextVar. "
130
- "reset` 方法還原變數到之前的值。 "
130
+ "回傳一個 :class:`~contextvars.Token` 物件,該物件可以用來還原變數到之前的值, "
131
+ "透過 :meth:`ContextVar. reset` 方法 "
131
132
132
133
#: ../../library/contextvars.rst:82
133
134
msgid ""
@@ -165,8 +166,8 @@ msgid ""
165
166
"be passed to the :meth:`ContextVar.reset` method to revert the value of the "
166
167
"variable to what it was before the corresponding *set*."
167
168
msgstr ""
168
- "*Token* 物件由 :meth:`ContextVar.set` 方法回傳。它們可以丟進 :meth:"
169
- "`ContextVar. reset` 方法,用以將變數的值還原為相對應的 *set* 之前的值。"
169
+ "*Token* 物件由 :meth:`ContextVar.set` 方法回傳,可以丟進 :meth:`ContextVar. "
170
+ "reset` 方法,用以將變數的值還原為相對應的 *set* 之前的值。"
170
171
171
172
#: ../../library/contextvars.rst:106
172
173
msgid ""
@@ -193,7 +194,7 @@ msgstr "手動情境管理"
193
194
194
195
#: ../../library/contextvars.rst:126
195
196
msgid "Returns a copy of the current :class:`~contextvars.Context` object."
196
- msgstr "傳回目前 :class:`~contextvars.Context` 物件的複本(copy)。"
197
+ msgstr "回傳目前 :class:`~contextvars.Context` 物件的複本(copy)。"
197
198
198
199
#: ../../library/contextvars.rst:128
199
200
msgid ""
@@ -216,7 +217,7 @@ msgid ""
216
217
"contexts with a few context variables and for contexts that have a lot of "
217
218
"them."
218
219
msgstr ""
219
- "這個函數具有 *O*\\ (1) 的複雜度,也就是說,對於只有少許情境變數的情境和有大量"
220
+ "這個函式具有 *O*\\ (1) 的複雜度,也就是說,對於只有少許情境變數的情境和有大量"
220
221
"情境變數的情境,速度都一樣快。"
221
222
222
223
#: ../../library/contextvars.rst:141
@@ -228,7 +229,7 @@ msgid ""
228
229
"``Context()`` creates an empty context with no values in it. To get a copy "
229
230
"of the current context use the :func:`~contextvars.copy_context` function."
230
231
msgstr ""
231
- "``Context()`` 會建立一個沒有值的空情境。要取得目前上下文的複本 ,請使用 :func:"
232
+ "``Context()`` 會建立一個沒有值的空情境。要取得目前情境的複本 ,請使用 :func:"
232
233
"`~contextvars.copy_context` 函式。"
233
234
234
235
#: ../../library/contextvars.rst:147
@@ -238,18 +239,18 @@ msgid ""
238
239
"current thread's stack. All :class:`!Context` objects in the stacks are "
239
240
"considered to be *entered*."
240
241
msgstr ""
241
- "每個執行緒都有自己的 :class:`!Context` 物件的有效堆疊 (stack)。 :term :"
242
- "`current context` 是目前執行緒堆疊頂端的 :class:`!Context` 物件。 堆疊中的所 "
243
- "有 :class:`!Context` 物件都被視為 *entered *。"
242
+ "每個執行緒都有自己的 :class:`!Context` 物件中目前主控中的堆疊 (stack)。 :"
243
+ "term: `current context` 是目前執行緒堆疊頂端的 :class:`!Context` 物件。 堆疊 "
244
+ "中的所有 :class:`!Context` 物件都被視為\\ *已進入 *。"
244
245
245
246
#: ../../library/contextvars.rst:152
246
247
msgid ""
247
248
"*Entering* a context, which can be done by calling its :meth:`~Context.run` "
248
249
"method, makes the context the current context by pushing it onto the top of "
249
250
"the current thread's context stack."
250
251
msgstr ""
251
- "*進入* 一個情境,可以藉由呼叫其 :meth:`~Context.run` 方法來完成,此 *進入* 的動 "
252
- "作會將一情境推到目前執行緒的情境堆疊的頂端 ,使該情境成為目前的情境。"
252
+ "*進入*\\ 一個情境,可以藉由呼叫其 :meth:`~Context.run` 方法來完成,此 \\ *進入"
253
+ "* \\ 的動作會將一情境推到目前執行緒的情境堆疊的頂端 ,使該情境成為目前的情境。"
253
254
254
255
#: ../../library/contextvars.rst:156
255
256
msgid ""
@@ -258,9 +259,9 @@ msgid ""
258
259
"context to what it was before the context was entered by popping the context "
259
260
"off the top of the context stack."
260
261
msgstr ""
261
- "*退出* 目前的情境,可以透過從傳遞給 :meth:`~Context.run` 方法的回呼函式"
262
- "(callback functions)中回傳來完成,這會將目前的情境還原到進入情境之前的狀 "
263
- "態 ,方法是將情境從情境堆疊的頂端彈出。"
262
+ "如果你傳遞給 :meth:`~Context.run` 方法的回呼函式(callback functions),該函 "
263
+ "式回傳之後,就會自動 \\ *退出* \\ 目前的情境,這會將目前的情境還原到進入情境之 "
264
+ "前的狀態 ,方法是將情境從情境堆疊的頂端彈出。"
264
265
265
266
#: ../../library/contextvars.rst:161
266
267
msgid ""
@@ -293,22 +294,22 @@ msgid ""
293
294
"the context)."
294
295
msgstr ""
295
296
"任何透過 :meth:`ContextVar.set` 方法對 :class:`ContextVar` 值的改變都會記錄在"
296
- "目前的情境中。 :meth:`ContextVar.get` 方法回傳與當前情境相關的值。 退出上下 "
297
- "文會有效地還原在進入上下文時對上下文變數所做的任何變更(如果需要,可以透過重 "
298
- "新進入上下文來還原值 )。"
297
+ "目前的情境中。 :meth:`ContextVar.get` 方法回傳與當前情境相關的值。 退出情境 "
298
+ "實際造成的效果會像是將其在進入情境時對情境變數所做的任何變一一彈出並還原(如 "
299
+ "果需要,可以透過重新進入情境來還原值 )。"
299
300
300
301
#: ../../library/contextvars.rst:177
301
302
msgid "Context implements the :class:`collections.abc.Mapping` interface."
302
- msgstr "情境實作 :class:`collections.abc.Mapping` 介面。"
303
+ msgstr "情境(Context)實作了 :class:`collections.abc.Mapping` 介面。"
303
304
304
305
#: ../../library/contextvars.rst:181
305
306
msgid ""
306
307
"Enters the Context, executes ``callable(*args, **kwargs)``, then exits the "
307
308
"Context. Returns *callable*'s return value, or propagates an exception if "
308
309
"one occurred."
309
310
msgstr ""
310
- "進入 Context,執行``callable(*args, **kwargs)``,然後退出 Context。 返回 "
311
- "*callable* 的回傳值,如果發生異常,則傳播異常 。"
311
+ "進入 Context,執行``callable(*args, **kwargs)``,然後退出 Context。 回傳 "
312
+ "*callable* 的回傳值,如果發生例外(exception),則傳播例外 。"
312
313
313
314
#: ../../library/contextvars.rst:185
314
315
msgid "Example:"
@@ -386,14 +387,15 @@ msgstr "回傳情境物件的淺層複本(shallow copy)。"
386
387
msgid ""
387
388
"Return ``True`` if the *context* has a value for *var* set; return ``False`` "
388
389
"otherwise."
389
- msgstr "如果*情境*裡面有 *var* 的值,則傳回 ``True``;否則傳回 ``False``。"
390
+ msgstr ""
391
+ "如果 \\ *情境*\\ 裡面有 *var* 的值,則回傳 ``True``,否則回傳 ``False``。"
390
392
391
393
#: ../../library/contextvars.rst:242
392
394
msgid ""
393
395
"Return the value of the *var* :class:`ContextVar` variable. If the variable "
394
396
"is not set in the context object, a :exc:`KeyError` is raised."
395
397
msgstr ""
396
- "傳回 *var* :class:`ContextVar` 變數的值。如果該變數並沒有在情境物件中設定,則"
398
+ "回傳 *var* :class:`ContextVar` 變數的值。如果該變數並沒有在情境物件中設定,則"
397
399
"會引發 :exc:`KeyError` 錯誤。"
398
400
399
401
#: ../../library/contextvars.rst:248
@@ -438,8 +440,7 @@ msgid ""
438
440
"available in the Task that handles that client::"
439
441
msgstr ""
440
442
":mod:`asyncio` 原生支援情境變數,不需任何額外設定。 舉例來說,以下是一個簡單"
441
- "的 echo 伺服器,使用上下文變數讓遠端用客戶端的位址在處理該用戶端的任務中可"
442
- "用:"
443
+ "的 echo 伺服器,使用情境變數讓遠端用客戶端的位址在處理該用戶端的任務中可用:"
443
444
444
445
#: ../../library/contextvars.rst:285
445
446
msgid ""
0 commit comments