Skip to content

Commit 1d03bdd

Browse files
committed
translated library/contextvars.po; i added my personal interpreations of the original text, otherwise it wouldn't be understandable in chinese
1 parent d19f0ee commit 1d03bdd

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

library/contextvars.po

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ msgstr ""
55
"Project-Id-Version: Python 3.13\n"
66
"Report-Msgid-Bugs-To: \n"
77
"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"
99
"Last-Translator: \n"
1010
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1111
"tw)\n"
@@ -27,9 +27,10 @@ msgid ""
2727
"the :class:`~contextvars.Context` class should be used to manage the current "
2828
"context in asynchronous frameworks."
2929
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+
"步框架中管理目前的情境。"
3334

3435
#: ../../library/contextvars.rst:17
3536
msgid ""
@@ -68,8 +69,8 @@ msgid ""
6869
"`ContextVar.get` when no value for the variable is found in the current "
6970
"context."
7071
msgstr ""
71-
"當在目前的情境中找不到變數的值時,:meth:`ContextVar.get` 會回傳 *default* 參數"
72-
"的值,此 *default* 參數只能用關鍵字來定義(關鍵字引數)。"
72+
"當在目前的情境中找不到變數的值時,:meth:`ContextVar.get` 會回傳 *default* "
73+
"數的值,此 *default* 參數只能用關鍵字來定義(關鍵字引數)。"
7374

7475
#: ../../library/contextvars.rst:42
7576
msgid ""
@@ -78,9 +79,9 @@ msgid ""
7879
"context variables which prevents context variables from being properly "
7980
"garbage collected."
8081
msgstr ""
81-
"**重要:** 情境變數應該在最頂端的模組層級建立,絕對不要在閉包(closure)中建"
82-
"。 :class:`Context` 物件持有情境變數的強參照,這會阻止情境變數被正確地垃圾"
83-
"回收(garbage collected)。"
82+
"**重要:**\\ 情境變數應該在最頂端的模組層級建立,絕對不要在閉包(closure)"
83+
"建立。 :class:`Context` 物件持有情境變數的強參照,這會阻止情境變數被正確地垃"
84+
"圾回收(garbage collected)。"
8485

8586
#: ../../library/contextvars.rst:49
8687
msgid "The name of the variable. This is a read-only property."
@@ -99,17 +100,17 @@ msgstr "如果在當前情境中沒有變數的值,此方法將:"
99100
#: ../../library/contextvars.rst:60
100101
msgid ""
101102
"return the value of the *default* argument of the method, if provided; or"
102-
msgstr "回傳方法的 *default* 引數值(如果有提供);或"
103+
msgstr "回傳方法的 *default* 引數值(如果有的話);否則"
103104

104105
#: ../../library/contextvars.rst:63
105106
msgid ""
106107
"return the default value for the context variable, if it was created with "
107108
"one; or"
108-
msgstr "回傳情境變數的預設值(如果是用情境變量建立的的話);"
109+
msgstr "回傳情境變數的預設值(如果是用情境變量建立的的話);否則"
109110

110111
#: ../../library/contextvars.rst:66
111112
msgid "raise a :exc:`LookupError`."
112-
msgstr "引發一個 :exc:`LookupError`。"
113+
msgstr "會引發一個 :exc:`LookupError`。"
113114

114115
#: ../../library/contextvars.rst:70
115116
msgid ""
@@ -126,8 +127,8 @@ msgid ""
126127
"Returns a :class:`~contextvars.Token` object that can be used to restore the "
127128
"variable to its previous value via the :meth:`ContextVar.reset` method."
128129
msgstr ""
129-
"回傳一個 :class:`~contextvars.Token` 物件,可以用來透過 :meth:`ContextVar."
130-
"reset` 方法還原變數到之前的值。"
130+
"回傳一個 :class:`~contextvars.Token` 物件,該物件可以用來還原變數到之前的值,"
131+
"透過 :meth:`ContextVar.reset` 方法"
131132

132133
#: ../../library/contextvars.rst:82
133134
msgid ""
@@ -165,8 +166,8 @@ msgid ""
165166
"be passed to the :meth:`ContextVar.reset` method to revert the value of the "
166167
"variable to what it was before the corresponding *set*."
167168
msgstr ""
168-
"*Token* 物件由 :meth:`ContextVar.set` 方法回傳。它們可以丟進 :meth:"
169-
"`ContextVar.reset` 方法,用以將變數的值還原為相對應的 *set* 之前的值。"
169+
"*Token* 物件由 :meth:`ContextVar.set` 方法回傳,可以丟進 :meth:`ContextVar."
170+
"reset` 方法,用以將變數的值還原為相對應的 *set* 之前的值。"
170171

171172
#: ../../library/contextvars.rst:106
172173
msgid ""
@@ -193,7 +194,7 @@ msgstr "手動情境管理"
193194

194195
#: ../../library/contextvars.rst:126
195196
msgid "Returns a copy of the current :class:`~contextvars.Context` object."
196-
msgstr "傳回目前 :class:`~contextvars.Context` 物件的複本(copy)。"
197+
msgstr "回傳目前 :class:`~contextvars.Context` 物件的複本(copy)。"
197198

198199
#: ../../library/contextvars.rst:128
199200
msgid ""
@@ -216,7 +217,7 @@ msgid ""
216217
"contexts with a few context variables and for contexts that have a lot of "
217218
"them."
218219
msgstr ""
219-
"這個函數具有 *O*\\ (1) 的複雜度,也就是說,對於只有少許情境變數的情境和有大量"
220+
"這個函式具有 *O*\\ (1) 的複雜度,也就是說,對於只有少許情境變數的情境和有大量"
220221
"情境變數的情境,速度都一樣快。"
221222

222223
#: ../../library/contextvars.rst:141
@@ -228,7 +229,7 @@ msgid ""
228229
"``Context()`` creates an empty context with no values in it. To get a copy "
229230
"of the current context use the :func:`~contextvars.copy_context` function."
230231
msgstr ""
231-
"``Context()`` 會建立一個沒有值的空情境。要取得目前上下文的複本,請使用 :func:"
232+
"``Context()`` 會建立一個沒有值的空情境。要取得目前情境的複本,請使用 :func:"
232233
"`~contextvars.copy_context` 函式。"
233234

234235
#: ../../library/contextvars.rst:147
@@ -238,18 +239,18 @@ msgid ""
238239
"current thread's stack. All :class:`!Context` objects in the stacks are "
239240
"considered to be *entered*."
240241
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` 物件都被視為\\ *已進入*。"
244245

245246
#: ../../library/contextvars.rst:152
246247
msgid ""
247248
"*Entering* a context, which can be done by calling its :meth:`~Context.run` "
248249
"method, makes the context the current context by pushing it onto the top of "
249250
"the current thread's context stack."
250251
msgstr ""
251-
"*進入* 一個情境,可以藉由呼叫其 :meth:`~Context.run` 方法來完成,此 *進入* 的動"
252-
"作會將一情境推到目前執行緒的情境堆疊的頂端,使該情境成為目前的情境。"
252+
"*進入*\\ 一個情境,可以藉由呼叫其 :meth:`~Context.run` 方法來完成,此 \\*進入"
253+
"*\\ 的動作會將一情境推到目前執行緒的情境堆疊的頂端,使該情境成為目前的情境。"
253254

254255
#: ../../library/contextvars.rst:156
255256
msgid ""
@@ -258,9 +259,9 @@ msgid ""
258259
"context to what it was before the context was entered by popping the context "
259260
"off the top of the context stack."
260261
msgstr ""
261-
"*退出* 目前的情境,可以透過從傳遞給 :meth:`~Context.run` 方法的回呼函式"
262-
"(callback functions)中回傳來完成,這會將目前的情境還原到進入情境之前的狀"
263-
",方法是將情境從情境堆疊的頂端彈出。"
262+
"如果你傳遞給 :meth:`~Context.run` 方法的回呼函式(callback functions),該函"
263+
"式回傳之後,就會自動 \\*退出*\\ 目前的情境,這會將目前的情境還原到進入情境之"
264+
"前的狀態,方法是將情境從情境堆疊的頂端彈出。"
264265

265266
#: ../../library/contextvars.rst:161
266267
msgid ""
@@ -293,22 +294,22 @@ msgid ""
293294
"the context)."
294295
msgstr ""
295296
"任何透過 :meth:`ContextVar.set` 方法對 :class:`ContextVar` 值的改變都會記錄在"
296-
"目前的情境中。 :meth:`ContextVar.get` 方法回傳與當前情境相關的值。 退出上下"
297-
"文會有效地還原在進入上下文時對上下文變數所做的任何變更(如果需要,可以透過重"
298-
"新進入上下文來還原值)。"
297+
"目前的情境中。 :meth:`ContextVar.get` 方法回傳與當前情境相關的值。 退出情境"
298+
"實際造成的效果會像是將其在進入情境時對情境變數所做的任何變一一彈出並還原(如"
299+
"果需要,可以透過重新進入情境來還原值)。"
299300

300301
#: ../../library/contextvars.rst:177
301302
msgid "Context implements the :class:`collections.abc.Mapping` interface."
302-
msgstr "情境實作 :class:`collections.abc.Mapping` 介面。"
303+
msgstr "情境(Context)實作了 :class:`collections.abc.Mapping` 介面。"
303304

304305
#: ../../library/contextvars.rst:181
305306
msgid ""
306307
"Enters the Context, executes ``callable(*args, **kwargs)``, then exits the "
307308
"Context. Returns *callable*'s return value, or propagates an exception if "
308309
"one occurred."
309310
msgstr ""
310-
"進入 Context,執行``callable(*args, **kwargs)``,然後退出 Context。 返回 "
311-
"*callable* 的回傳值,如果發生異常,則傳播異常。"
311+
"進入 Context,執行``callable(*args, **kwargs)``,然後退出 Context。 回傳 "
312+
"*callable* 的回傳值,如果發生例外(exception),則傳播例外。"
312313

313314
#: ../../library/contextvars.rst:185
314315
msgid "Example:"
@@ -386,14 +387,15 @@ msgstr "回傳情境物件的淺層複本(shallow copy)。"
386387
msgid ""
387388
"Return ``True`` if the *context* has a value for *var* set; return ``False`` "
388389
"otherwise."
389-
msgstr "如果*情境*裡面有 *var* 的值,則傳回 ``True``;否則傳回 ``False``。"
390+
msgstr ""
391+
"如果 \\*情境*\\ 裡面有 *var* 的值,則回傳 ``True``,否則回傳 ``False``。"
390392

391393
#: ../../library/contextvars.rst:242
392394
msgid ""
393395
"Return the value of the *var* :class:`ContextVar` variable. If the variable "
394396
"is not set in the context object, a :exc:`KeyError` is raised."
395397
msgstr ""
396-
"傳回 *var* :class:`ContextVar` 變數的值。如果該變數並沒有在情境物件中設定,則"
398+
"回傳 *var* :class:`ContextVar` 變數的值。如果該變數並沒有在情境物件中設定,則"
397399
"會引發 :exc:`KeyError` 錯誤。"
398400

399401
#: ../../library/contextvars.rst:248
@@ -438,8 +440,7 @@ msgid ""
438440
"available in the Task that handles that client::"
439441
msgstr ""
440442
":mod:`asyncio` 原生支援情境變數,不需任何額外設定。 舉例來說,以下是一個簡單"
441-
"的 echo 伺服器,使用上下文變數讓遠端用客戶端的位址在處理該用戶端的任務中可"
442-
"用:"
443+
"的 echo 伺服器,使用情境變數讓遠端用客戶端的位址在處理該用戶端的任務中可用:"
443444

444445
#: ../../library/contextvars.rst:285
445446
msgid ""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy