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

Skip to content

Commit a089aef

Browse files
[po] auto sync
1 parent 214efd3 commit a089aef

15 files changed

Lines changed: 487 additions & 263 deletions

File tree

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "89.68%", "updated_at": "2023-09-22T15:42:27Z"}
1+
{"translation": "89.83%", "updated_at": "2023-09-23T04:42:16Z"}

c-api/sys.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ msgid ""
1212
msgstr ""
1313
"Project-Id-Version: Python 3.11\n"
1414
"Report-Msgid-Bugs-To: \n"
15-
"POT-Creation-Date: 2023-09-15 14:42+0000\n"
15+
"POT-Creation-Date: 2023-09-22 14:44+0000\n"
1616
"PO-Revision-Date: 2023-05-24 02:09+0000\n"
1717
"Last-Translator: Freesand Leo <[email protected]>, 2023\n"
1818
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"

c-api/typeobj.po

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ msgid ""
1111
msgstr ""
1212
"Project-Id-Version: Python 3.11\n"
1313
"Report-Msgid-Bugs-To: \n"
14-
"POT-Creation-Date: 2023-09-15 14:42+0000\n"
14+
"POT-Creation-Date: 2023-09-22 14:44+0000\n"
1515
"PO-Revision-Date: 2023-05-24 02:09+0000\n"
1616
"Last-Translator: Rafael Fontenelle <[email protected]>, 2023\n"
1717
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
@@ -1593,6 +1593,9 @@ msgid ""
15931593
"behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the"
15941594
" instance falls back to :c:member:`~PyTypeObject.tp_call`."
15951595
msgstr ""
1596+
"*vectorcallfunc* 指针可能为 ``NULL``,在这种情况下实例的行为就像 "
1597+
":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` 没有被设置一样:调用实例操作会回退至 "
1598+
":c:member:`~PyTypeObject.tp_call`。"
15961599

15971600
#: ../../c-api/typeobj.rst:726
15981601
msgid ""
@@ -1601,6 +1604,9 @@ msgid ""
16011604
"with the *vectorcallfunc* function. This can be done by setting *tp_call* to"
16021605
" :c:func:`PyVectorcall_Call`."
16031606
msgstr ""
1607+
"任何设置了 ``Py_TPFLAGS_HAVE_VECTORCALL`` 的类也必须设置 "
1608+
":c:member:`~PyTypeObject.tp_call` 并确保其行为与 *vectorcallfunc* 函数一致。 这可以通过将 "
1609+
"*tp_call* 设为 :c:func:`PyVectorcall_Call` 来实现。"
16041610

16051611
#: ../../c-api/typeobj.rst:733
16061612
msgid ""
@@ -1615,6 +1621,8 @@ msgid ""
16151621
"Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was "
16161622
"used for printing to a file. In Python 3.0 to 3.7, it was unused."
16171623
msgstr ""
1624+
"在 3.8 版之前,这个槽位被命名为 ``tp_print``。 在 Python 2.x 中,它被用于打印到文件。 在 Python 3.0 至 "
1625+
"3.7 中,它没有被使用。"
16181626

16191627
#: ../../c-api/typeobj.rst:746
16201628
msgid ""
@@ -1756,32 +1764,34 @@ msgid ""
17561764
"returned, where ``%s`` is replaced by the type name, and ``%p`` by the "
17571765
"object's memory address."
17581766
msgstr ""
1767+
"如果未设置该字段,则返回 ``<%s object at %p>`` 形式的字符串,其中 ``%s`` 将替换为类型名称,``%p`` "
1768+
"将替换为对象的内存地址。"
17591769

17601770
#: ../../c-api/typeobj.rst:836
17611771
msgid ""
17621772
"Pointer to an additional structure that contains fields relevant only to "
17631773
"objects which implement the number protocol. These fields are documented in"
17641774
" :ref:`number-structs`."
1765-
msgstr ""
1775+
msgstr "指向一个附加结构体的指针,其中包含只与执行数字协议的对象相关的字段。 这些字段的文档参见 :ref:`number-structs`。"
17661776

17671777
#: ../../c-api/typeobj.rst:842
17681778
msgid ""
17691779
"The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the "
17701780
"contained fields are inherited individually."
1771-
msgstr ""
1781+
msgstr ":c:member:`~PyTypeObject.tp_as_number` 字段不会被继承,但所包含的字段会被单独继承。"
17721782

17731783
#: ../../c-api/typeobj.rst:848
17741784
msgid ""
17751785
"Pointer to an additional structure that contains fields relevant only to "
17761786
"objects which implement the sequence protocol. These fields are documented "
17771787
"in :ref:`sequence-structs`."
1778-
msgstr ""
1788+
msgstr "指向一个附加结构体的指针,其中包含只与执行序列协议的对象相关的字段。 这些字段的文档见 :ref:`sequence-structs`。"
17791789

17801790
#: ../../c-api/typeobj.rst:854
17811791
msgid ""
17821792
"The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the"
17831793
" contained fields are inherited individually."
1784-
msgstr ""
1794+
msgstr ":c:member:`~PyTypeObject.tp_as_sequence` 字段不会被继承,但所包含的字段会被单独继承。"
17851795

17861796
#: ../../c-api/typeobj.rst:860
17871797
msgid ""

extending/newtypes_tutorial.po

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ msgid ""
1111
msgstr ""
1212
"Project-Id-Version: Python 3.11\n"
1313
"Report-Msgid-Bugs-To: \n"
14-
"POT-Creation-Date: 2023-09-01 14:43+0000\n"
14+
"POT-Creation-Date: 2023-09-22 14:44+0000\n"
1515
"PO-Revision-Date: 2023-05-24 02:10+0000\n"
1616
"Last-Translator: Rafael Fontenelle <[email protected]>, 2023\n"
1717
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
@@ -265,12 +265,14 @@ msgid ""
265265
"to the appropriate default values, including :c:member:`~PyObject.ob_type` "
266266
"that we initially set to ``NULL``. ::"
267267
msgstr ""
268+
"这将初始化 :class:`!Custom` 类型,为一些成员填充适当的默认值,包括我们在初始时设为 ``NULL`` 的 "
269+
":c:member:`~PyObject.ob_type`。 ::"
268270

269271
#: ../../extending/newtypes_tutorial.rst:190
270272
msgid ""
271273
"This adds the type to the module dictionary. This allows us to create "
272274
":class:`!Custom` instances by calling the :class:`!Custom` class:"
273-
msgstr ""
275+
msgstr "这将把类型添加到模块字典中。 这样我们就能通过调用 :class:`!Custom` 类来创建 :class:`!Custom` 实例:"
274276

275277
#: ../../extending/newtypes_tutorial.rst:198
276278
msgid ""
@@ -321,6 +323,8 @@ msgid ""
321323
"make the type usable as a base class. We'll create a new module, "
322324
":mod:`!custom2` that adds these capabilities:"
323325
msgstr ""
326+
"让我们通过添加一些数据和方法来扩展这个基本示例。 让我们再使该类型可以作为基类使用。 我们将创建一个新模块 :mod:`!custom2` "
327+
"来添加这些功能:"
324328

325329
#: ../../extending/newtypes_tutorial.rst:240
326330
msgid "This version of the module has a number of changes."
@@ -343,6 +347,8 @@ msgid ""
343347
"strings containing first and last names. The *number* attribute is a C "
344348
"integer."
345349
msgstr ""
350+
"现在 :class:`!Custom` 类型的 C 结构体中有三个数据属性,*first*、*last* 和 *number*。 其中 *first* "
351+
"和 *last* 变量是包含名字和姓氏的 Python 字符串。 *number* 属性是一个 C 整数。"
346352

347353
#: ../../extending/newtypes_tutorial.rst:253
348354
msgid "The object structure is updated accordingly::"
@@ -368,6 +374,10 @@ msgid ""
368374
"object's type might not be :class:`!CustomType`, because the object may be "
369375
"an instance of a subclass."
370376
msgstr ""
377+
"此方法会先清空两个 Python 属性的引用计数。 :c:func:`Py_XDECREF` 可以正确处理参数为 ``NULL`` 的情况(这可能在 "
378+
"``tp_new`` 中途失败时发生)。 随后它将调用对象类型的 :c:member:`~PyTypeObject.tp_free` 成员(通过 "
379+
"``Py_TYPE(self)`` 计算得到)来释放对象的内存。 请注意对象类型可以不是 "
380+
":class:`!CustomType`,因为对象可能是一个子类的实例。"
371381

372382
#: ../../extending/newtypes_tutorial.rst:286
373383
msgid ""
@@ -402,6 +412,10 @@ msgid ""
402412
" initialize the ``first`` and ``last`` attributes to non-``NULL`` default "
403413
"values."
404414
msgstr ""
415+
"``tp_new`` 处理句柄负责创建(而不是初始化)该类型的对象。 它在 Python 中被暴露为 :meth:`~object.__new__` "
416+
"方法。 它不需要定义 ``tp_new`` 成员,实际上许多扩展类型会简单地重用 :c:func:`PyType_GenericNew`,就像上面 "
417+
":class:`!Custom` 类型的第一个版本所做的那样。 在此情况下,我们使用 ``tp_new`` 处理句柄来将 ``first`` 和 "
418+
"``last`` 属性初始化为非 ``NULL`` 的默认值。"
405419

406420
#: ../../extending/newtypes_tutorial.rst:328
407421
msgid ""
@@ -461,6 +475,12 @@ msgid ""
461475
" may not be able to create instances of such subclasses without getting a "
462476
":exc:`TypeError`.)"
463477
msgstr ""
478+
"如果您要创建一个协作式 :c:member:`~PyTypeObject.tp_new` (它会调用基类型的 "
479+
":c:member:`~PyTypeObject.tp_new` 或 :meth:`~object.__new__`),那么你 *不能* "
480+
"在运行时尝试使用方法解析顺序来确定要调用的方法。 必须总是静态地确定你要调用的类型,并直接调用它的 "
481+
":c:member:`~PyTypeObject.tp_new`,或是通过 ``type->tp_base->tp_new``。 "
482+
"如果你不这样做,你的类型的同样继承自其它由 Python 定义的类的 Python 子类可能无法正常工作。 "
483+
"(具体地说,你可能无法创建这样的子类的实例而是会引发 :exc:`TypeError`。)"
464484

465485
#: ../../extending/newtypes_tutorial.rst:364
466486
msgid ""
@@ -479,6 +499,8 @@ msgid ""
479499
"it's created. Initializers always accept positional and keyword arguments, "
480500
"and they should return either ``0`` on success or ``-1`` on error."
481501
msgstr ""
502+
":c:member:`~PyTypeObject.tp_init` 槽位在 Python 中暴露为 :meth:`~object.__init__` "
503+
"方法。 它被用来在创建对象后对其进行初始化。 初始化器总是接受位置和关键字参数,它们应当在成功时返回 ``0`` 而在出错时返回 ``-1``。"
482504

483505
#: ../../extending/newtypes_tutorial.rst:402
484506
msgid ""
@@ -490,6 +512,9 @@ msgid ""
490512
"new attribute values. We might be tempted, for example to assign the "
491513
"``first`` member like this::"
492514
msgstr ""
515+
"不同于 ``tp_new`` 处理句柄,``tp_init`` 不保证一定会被调用 (例如,在默认情况下 :mod:`pickle` "
516+
"模块不会在未解封的实例上调用 :meth:`~object.__init__`)。 它还可能被多次调用。 任何人都可以在我们的对象上调用 "
517+
":meth:`!__init__` 方法。 因此,我们在为属性赋新值时必须格外小心。 例如像这样给 ``first`` 成员赋值::"
493518

494519
#: ../../extending/newtypes_tutorial.rst:416
495520
msgid ""
@@ -566,7 +591,7 @@ msgstr ""
566591
msgid ""
567592
"We define a single method, :meth:`!Custom.name()`, that outputs the objects "
568593
"name as the concatenation of the first and last names. ::"
569-
msgstr ""
594+
msgstr "我们定义了一个单独的方法,:meth:`!Custom.name()`,它将对象名称输出为 first 和 last 的拼接。 ::"
570595

571596
#: ../../extending/newtypes_tutorial.rst:480
572597
msgid ""
@@ -577,6 +602,9 @@ msgid ""
577602
" to accept a positional argument tuple or keyword argument dictionary. This "
578603
"method is equivalent to the Python method:"
579604
msgstr ""
605+
"该方法以的实现形式是一个接受 :class:`!Custom` (或:class:`!Custom` 的子类) 实例作为第一个参数的 C 函数。 "
606+
"方法总是接受一个实例作为第一个参数。 方法往往也接受位置和关键字参数,但在本例中我们未接受任何参数也不需要接受位置参数元组或关键字参数字典。 "
607+
"该方法等价于以下 Python 方法:"
580608

581609
#: ../../extending/newtypes_tutorial.rst:492
582610
msgid ""
@@ -586,6 +614,9 @@ msgid ""
586614
"deletion of these attributes and to restrict the attribute values to be "
587615
"strings. We'll see how to do that in the next section."
588616
msgstr ""
617+
"请注意我们必须检查 :attr:`!first` 和 :attr:`!last` 成员是否可能为 ``NULL``。 "
618+
"这是因为它们可以被删除,在此情况下它们会被设为 ``NULL``。 更好的做法是防止删除这些属性并将属性的值限制为字符串。 "
619+
"我们将在下一节了解如何做到这一点。"
589620

590621
#: ../../extending/newtypes_tutorial.rst:498
591622
msgid ""
@@ -619,14 +650,16 @@ msgid ""
619650
"module name in the :c:type:`PyModuleDef` struct, and update the full class "
620651
"name in the :c:type:`PyTypeObject` struct."
621652
msgstr ""
653+
"我们将 :c:func:`!PyInit_custom` 重命名为 :c:func:`!PyInit_custom2`,更新 "
654+
":c:type:`PyModuleDef` 结构体中的模块名称,并更新 :c:type:`PyTypeObject` 结构体中的完整类名。"
622655

623656
#: ../../extending/newtypes_tutorial.rst:526
624657
msgid "Finally, we update our :file:`setup.py` file to build the new module:"
625658
msgstr "最后,我们更新我们的 :file:`setup.py` 文件来生成新的模块。"
626659

627660
#: ../../extending/newtypes_tutorial.rst:539
628661
msgid "Providing finer control over data attributes"
629-
msgstr "提供对于数据属性的更精细控制Providing finer control over data attributes"
662+
msgstr "提供对于数据属性的更精细控制"
630663

631664
#: ../../extending/newtypes_tutorial.rst:541
632665
msgid ""
@@ -636,13 +669,18 @@ msgid ""
636669
":attr:`!last` could be set to non-string values or even deleted. We want to "
637670
"make sure that these attributes always contain strings."
638671
msgstr ""
672+
"在本节中,我们将对 :class:`!Custom` 示例中 :attr:`!first` 和 :attr:`!last` 属性的设置进行更精细的控制。"
673+
" 在我们上一版本的模块中,实例变量 :attr:`!first` 和 :attr:`!last` 可以被设为非字符串值甚至被删除。 "
674+
"我们希望确保这些属性始终包含字符串。"
639675

640676
#: ../../extending/newtypes_tutorial.rst:550
641677
msgid ""
642678
"To provide greater control, over the :attr:`!first` and :attr:`!last` "
643679
"attributes, we'll use custom getter and setter functions. Here are the "
644680
"functions for getting and setting the :attr:`!first` attribute::"
645681
msgstr ""
682+
"为了更好地控制 :attr:`!first` 和 :attr:`!last` 属性,我们将使用自定义的读取器和设置器函数。 以下就是用于读取和设置 "
683+
":attr:`!first` 属性的函数::"
646684

647685
#: ../../extending/newtypes_tutorial.rst:581
648686
msgid ""
@@ -653,6 +691,8 @@ msgid ""
653691
"of getter and setter functions that decide the attribute to get or set based"
654692
" on data in the closure.)"
655693
msgstr ""
694+
"读取器函数接受一个 :class:`!Custom` 对象和一个“闭包”,后者是一个空指针。 在本例中,该闭包将被忽略。 (闭包支持将定义数据传递给 "
695+
"读取器和设置器的高级用法。 例如,这可以被用来允许一组获取器和设置器函数根据闭包中的数据来决定要读取或设置的属性)。"
656696

657697
#: ../../extending/newtypes_tutorial.rst:587
658698
msgid ""
@@ -661,6 +701,8 @@ msgid ""
661701
" is being deleted. In our setter, we raise an error if the attribute is "
662702
"deleted or if its new value is not a string."
663703
msgstr ""
704+
"设置器函数接受传入 :class:`!Custom` 对象、新值和闭包。 新值可能为 ``NULL``,在这种情况下属性将被删除。 "
705+
"在我们的设置器中,如果属性被删除或者如果其新值不是字符串则会引发一个错误。"
664706

665707
#: ../../extending/newtypes_tutorial.rst:592
666708
msgid "We create an array of :c:type:`PyGetSetDef` structures::"
@@ -741,6 +783,9 @@ msgid ""
741783
":class:`!Custom`, and subclasses may add arbitrary attributes. For any of "
742784
"those two reasons, :class:`!Custom` objects can participate in cycles:"
743785
msgstr ""
786+
"在 :class:`!Custom` 示例的第二个版本中,我们允许任意类型的对象存储到 :attr:`!first` 或 :attr:`!last` "
787+
"属性中 [#]_。 此外,在第二和第三个版本中,我们还允许子类化 :class:`!Custom`,并且子类可以添加任意属性。 "
788+
"出于这两个原因中的任何一个,:class:`!Custom` 对象都可以加入循环:"
744789

745790
#: ../../extending/newtypes_tutorial.rst:690
746791
msgid ""
@@ -749,6 +794,8 @@ msgid ""
749794
"type needs to fill two additional slots and to enable a flag that enables "
750795
"these slots:"
751796
msgstr ""
797+
"要允许一个加入引用循环的 :class:`!Custom` 实例能被循环 GC 正确检测和收集,我们的 :class:`!Custom` "
798+
"类型需要填充两个额外的槽位并增加一个旗标来启用这些槽位:"
752799

753800
#: ../../extending/newtypes_tutorial.rst:697
754801
msgid ""
@@ -764,6 +811,8 @@ msgid ""
764811
"argument *arg* passed to the traversal method. It returns an integer value "
765812
"that must be returned if it is non-zero."
766813
msgstr ""
814+
"对于每个可以加入循环的子对象,我们都需要调用 :c:func:`!visit` 函数,它会被传递给遍历方法。 :c:func:`!visit` "
815+
"函数接受该子对象和传递给遍历方法的额外参数 *arg* 作为其参数。 它返回一个在其为非零值时必须被返回的整数值。"
767816

768817
#: ../../extending/newtypes_tutorial.rst:723
769818
msgid ""
@@ -863,13 +912,15 @@ msgid ""
863912
"with regular lists, but will have an additional :meth:`!increment` method "
864913
"that increases an internal counter:"
865914
msgstr ""
915+
"在本例中我们将创建一个继承自内置 :class:`list` 类型的 :class:`!SubList` 类型。 "
916+
"这个新类型将完全兼容常规列表,但将拥有一个额外的 :meth:`!increment` 方法用于递增内部计数器的值:"
866917

867918
#: ../../extending/newtypes_tutorial.rst:821
868919
msgid ""
869920
"As you can see, the source code closely resembles the :class:`!Custom` "
870921
"examples in previous sections. We will break down the main differences "
871922
"between them. ::"
872-
msgstr ""
923+
msgstr "如你所见,此源代码与之前几节中的 :class:`!Custom` 示例非常相似。 我们将逐一分析它们之间的主要区别。 ::"
873924

874925
#: ../../extending/newtypes_tutorial.rst:829
875926
msgid ""
@@ -885,12 +936,14 @@ msgid ""
885936
"pointer can be safely cast to both ``PyListObject *`` and ``SubListObject "
886937
"*``::"
887938
msgstr ""
939+
"当一个 Python 对象是 :class:`!SubList` 的实例时,它的 ``PyObject *`` 指针可以被安全地强制转换为 "
940+
"``PyListObject *`` 和 ``SubListObject *``::"
888941

889942
#: ../../extending/newtypes_tutorial.rst:845
890943
msgid ""
891944
"We see above how to call through to the :meth:`~object.__init__` method of "
892945
"the base type."
893-
msgstr ""
946+
msgstr "我们可以在上面看到如何将调用传递到基类型的 :meth:`~object.__init__` 方法。"
894947

895948
#: ../../extending/newtypes_tutorial.rst:848
896949
msgid ""
@@ -935,6 +988,7 @@ msgid ""
935988
"After that, calling :c:func:`PyType_Ready` and adding the type object to the"
936989
" module is the same as with the basic :class:`!Custom` examples."
937990
msgstr ""
991+
"在那之后,调用 :c:func:`PyType_Ready` 并将类型对象添加到模块中的过程与基本的 :class:`!Custom` 示例是一样的。"
938992

939993
#: ../../extending/newtypes_tutorial.rst:893
940994
msgid "Footnotes"

faq/general.po

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
# Translators:
77
# Freesand Leo <[email protected]>, 2023
88
# Rafael Fontenelle <[email protected]>, 2023
9-
# LeeWendao <[email protected]>, 2023
109
#
1110
#, fuzzy
1211
msgid ""
1312
msgstr ""
1413
"Project-Id-Version: Python 3.11\n"
1514
"Report-Msgid-Bugs-To: \n"
16-
"POT-Creation-Date: 2023-09-15 14:42+0000\n"
15+
"POT-Creation-Date: 2023-09-22 14:44+0000\n"
1716
"PO-Revision-Date: 2023-05-24 02:11+0000\n"
18-
"Last-Translator: LeeWendao <LeeWendao@outlook.com>, 2023\n"
17+
"Last-Translator: Rafael Fontenelle <rffontenelle@gmail.com>, 2023\n"
1918
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2019
"MIME-Version: 1.0\n"
2120
"Content-Type: text/plain; charset=UTF-8\n"
@@ -697,7 +696,7 @@ msgstr "Python 是一种对编程初学者友好的语言吗?"
697696

698697
#: ../../faq/general.rst:376
699698
msgid "Yes."
700-
msgstr "是的。"
699+
msgstr "有的。"
701700

702701
#: ../../faq/general.rst:378
703702
msgid ""

0 commit comments

Comments
 (0)