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

Skip to content

Commit 24ad263

Browse files
[po] auto sync
1 parent b01d87c commit 24ad263

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "89.76%", "updated_at": "2023-08-13T08:56:58Z"}
1+
{"translation": "89.78%", "updated_at": "2023-08-13T22:56:24Z"}

library/ctypes.po

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,13 @@ msgstr ""
578578
msgid ""
579579
"On those platforms it is required to specify the :attr:`~_FuncPtr.argtypes` "
580580
"attribute for the regular, non-variadic, function arguments:"
581-
msgstr ""
581+
msgstr "在这些平台上要求为常规、非可变函数参数指定 :attr:`~_FuncPtr.argtypes` 属性:"
582582

583583
#: ../../library/ctypes.rst:394
584584
msgid ""
585585
"Because specifying the attribute does not inhibit portability it is advised "
586586
"to always specify :attr:`~_FuncPtr.argtypes` for all variadic functions."
587-
msgstr ""
587+
msgstr "因为指定该属性不会影响可移植性所以建议总是为所有可变函数指定 :attr:`~_FuncPtr.argtypes`。"
588588

589589
#: ../../library/ctypes.rst:401
590590
msgid "Calling functions with your own custom data types"
@@ -598,13 +598,18 @@ msgid ""
598598
" The attribute must be an integer, string, bytes, a :mod:`ctypes` instance, "
599599
"or an object with an :attr:`!_as_parameter_` attribute::"
600600
msgstr ""
601+
"您也可以通过自定义 :mod:`ctypes` 参数转换方式来允许将你自己的类实例作为函数参数。 :mod:`ctypes` 会寻找 "
602+
":attr:`!_as_parameter_` 属性并使用它作为函数参数。 属性必须是整数、字符串、字节串、:mod:`ctypes` 实例或者带有 "
603+
":attr:`!_as_parameter_` 属性的对象::"
601604

602605
#: ../../library/ctypes.rst:419
603606
msgid ""
604607
"If you don't want to store the instance's data in the "
605608
":attr:`!_as_parameter_` instance variable, you could define a "
606609
":class:`property` which makes the attribute available on request."
607610
msgstr ""
611+
"如果你不想将实例数据存储在 :attr:`!_as_parameter_` 实例变量中,可以定义一个根据请求提供属性的 "
612+
":class:`property`。"
608613

609614
#: ../../library/ctypes.rst:427
610615
msgid "Specifying the required argument types (function prototypes)"
@@ -614,7 +619,7 @@ msgstr "指定必选参数的类型(函数原型)"
614619
msgid ""
615620
"It is possible to specify the required argument types of functions exported "
616621
"from DLLs by setting the :attr:`~_FuncPtr.argtypes` attribute."
617-
msgstr ""
622+
msgstr "可以通过设置 :attr:`~_FuncPtr.argtypes` 属性来指定从 DLL 导出函数的必选参数类型。"
618623

619624
#: ../../library/ctypes.rst:432
620625
msgid ""
@@ -624,6 +629,8 @@ msgid ""
624629
"format string, on the other hand this is quite handy to experiment with this"
625630
" feature)::"
626631
msgstr ""
632+
":attr:`~_FuncPtr.argtypes` 必须是一个 C 数据类型的序列(这里 :func:`!printf` "
633+
"函数可能不是一个好例子,因为它会根据格式字符串的不同接受可变数量和不同类型的形参,但另一方面这对尝试此功能来说也很方便)::"
627634

628635
#: ../../library/ctypes.rst:443
629636
msgid ""
@@ -645,6 +652,11 @@ msgid ""
645652
"string, bytes, a :mod:`ctypes` instance, or an object with an "
646653
":attr:`!_as_parameter_` attribute."
647654
msgstr ""
655+
"如果你定义了自己的类并将其传递给函数调用,则你必须为它们实现 :meth:`~_CData.from_param` 类方法才能够在 "
656+
":attr:`~_FuncPtr.argtypes` 序列中使用它们。 :meth:`~_CData.from_param` "
657+
"类方法将接受传递给函数调用的 Python 对象,它应该进行类型检查或者其他必要的操作以确保这个对象是可接受的,然后返回对象本身、它的 "
658+
":attr:`!_as_parameter_` 属性或在此情况下作为 C 函数参数传入的任何东西。 "
659+
"同样,结果应该是整数、字符串、字节串、:mod:`ctypes` 实例或具有 :attr:`!_as_parameter_` 属性的对象。"
648660

649661
#: ../../library/ctypes.rst:469
650662
msgid "Return types"
@@ -664,10 +676,12 @@ msgid ""
664676
":c:type:`time_t` might be of a different type than the default return type "
665677
":c:expr:`int`, you should specify the :attr:`!restype` attribute::"
666678
msgstr ""
679+
":c:func:`time` 的 C 原型是 ``time_t time(time_t *)``。 由于 :c:type:`time_t` "
680+
"的类型可能不同于默认返回类型 :c:expr:`int`,你应当指定 :attr:`!restype` 属性::"
667681

668682
#: ../../library/ctypes.rst:489
669683
msgid "The argument types can be specified using :attr:`~_FuncPtr.argtypes`::"
670-
msgstr ""
684+
msgstr "参数类型可以使用 :attr:`~_FuncPtr.argtypes` 来指定::"
671685

672686
#: ../../library/ctypes.rst:493
673687
msgid ""
@@ -679,14 +693,16 @@ msgstr "调用该函数时如果要将 ``NULL`` 指针作为第一个参数,
679693
msgid ""
680694
"Here is a more advanced example, it uses the :func:`strchr` function, which "
681695
"expects a string pointer and a char, and returns a pointer to a string::"
682-
msgstr ""
696+
msgstr "下面是一个更高级的示例,它使用了 :func:`strchr` 函数,该函数接收一个字符串指针和一个字符,并返回一个字符串指针::"
683697

684698
#: ../../library/ctypes.rst:511
685699
msgid ""
686700
"If you want to avoid the :func:`ord(\"x\") <ord>` calls above, you can set "
687701
"the :attr:`~_FuncPtr.argtypes` attribute, and the second argument will be "
688702
"converted from a single character Python bytes object into a C char:"
689703
msgstr ""
704+
"如果你想要避免上面的 :func:`ord(\"x\") <ord>` 调用,你可以设置 :attr:`~_FuncPtr.argtypes` "
705+
"属性,第二个参数将从单字符 Python 字节串对象转换为 C char:"
690706

691707
#: ../../library/ctypes.rst:530
692708
msgid ""

0 commit comments

Comments
 (0)