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

Skip to content

Commit fc0d0cc

Browse files
committed
[po] auto sync bot
1 parent 6fc2477 commit fc0d0cc

5 files changed

Lines changed: 91 additions & 30 deletions

File tree

distutils/introduction.po

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# SOME DESCRIPTIVE TITLE.
2-
# Copyright (C) 2001-2018, Python Software Foundation
2+
# Copyright (C) 2001-2019, Python Software Foundation
33
# This file is distributed under the same license as the Python package.
44
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55
#
6+
# Translators:
7+
# Shengjing Zhu <[email protected]>, 2018
8+
# gashero liu <[email protected]>, 2019
9+
#
610
#, fuzzy
711
msgid ""
812
msgstr ""
913
"Project-Id-Version: Python 3.7\n"
1014
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2018-06-30 05:56+0900\n"
12-
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13-
"Last-Translator: Shengjing Zhu <zsj950618@gmail.com>, 2018\n"
15+
"POT-Creation-Date: 2019-01-01 10:14+0900\n"
16+
"PO-Revision-Date: 2017-02-16 17:41+0000\n"
17+
"Last-Translator: gashero liu <harry.python@gmail.com>, 2019\n"
1418
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
1519
"MIME-Version: 1.0\n"
1620
"Content-Type: text/plain; charset=UTF-8\n"
@@ -77,7 +81,7 @@ msgstr ""
7781

7882
#: ../../distutils/introduction.rst:47
7983
msgid "A Simple Example"
80-
msgstr ""
84+
msgstr "一个简单的例子"
8185

8286
#: ../../distutils/introduction.rst:49
8387
msgid ""

extending/extending.po

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SOME DESCRIPTIVE TITLE.
2-
# Copyright (C) 2001-2018, Python Software Foundation
2+
# Copyright (C) 2001-2019, Python Software Foundation
33
# This file is distributed under the same license as the Python package.
44
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55
#
@@ -8,15 +8,16 @@
88
# 操旭 <[email protected]>, 2017
99
# Tony Tong <[email protected]>, 2018
1010
# ww song <[email protected]>, 2018
11+
# gashero liu <[email protected]>, 2019
1112
#
1213
#, fuzzy
1314
msgid ""
1415
msgstr ""
1516
"Project-Id-Version: Python 3.7\n"
1617
"Report-Msgid-Bugs-To: \n"
17-
"POT-Creation-Date: 2018-11-01 09:38+0900\n"
18+
"POT-Creation-Date: 2019-01-01 10:14+0900\n"
1819
"PO-Revision-Date: 2017-02-16 17:42+0000\n"
19-
"Last-Translator: ww song <sww4718168@gmail.com>, 2018\n"
20+
"Last-Translator: gashero liu <harry.python@gmail.com>, 2019\n"
2021
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2122
"MIME-Version: 1.0\n"
2223
"Content-Type: text/plain; charset=UTF-8\n"
@@ -26,15 +27,15 @@ msgstr ""
2627

2728
#: ../../extending/extending.rst:8
2829
msgid "Extending Python with C or C++"
29-
msgstr ""
30+
msgstr "使用C/C++扩展Python"
3031

3132
#: ../../extending/extending.rst:10
3233
msgid ""
3334
"It is quite easy to add new built-in modules to Python, if you know how to "
3435
"program in C. Such :dfn:`extension modules` can do two things that can't be"
3536
" done directly in Python: they can implement new built-in object types, and "
3637
"they can call C library functions and system calls."
37-
msgstr ""
38+
msgstr "如果你会用C,实现Python嵌入模块很简单。利用扩展模块可做很多Python不方便做的事情,他们可以直接调用C库和系统调用。"
3839

3940
#: ../../extending/extending.rst:15
4041
msgid ""
@@ -43,12 +44,14 @@ msgid ""
4344
" aspects of the Python run-time system. The Python API is incorporated in a"
4445
" C source file by including the header ``\"Python.h\"``."
4546
msgstr ""
47+
"为了支持扩展,Python API定义了一系列函数、宏和变量,提供了对Python运行时系统的访问支持。Python的C API由C源码组成,并包含 "
48+
"\"Python.h\" 头文件。"
4649

4750
#: ../../extending/extending.rst:20
4851
msgid ""
4952
"The compilation of an extension module depends on its intended use as well "
5053
"as on your system setup; details are given in later chapters."
51-
msgstr ""
54+
msgstr "编写扩展模块与你的系统相关,下面会详解。"
5255

5356
#: ../../extending/extending.rst:25
5457
msgid ""
@@ -65,7 +68,7 @@ msgstr ""
6568

6669
#: ../../extending/extending.rst:40
6770
msgid "A Simple Example"
68-
msgstr ""
71+
msgstr "一个简单的例子"
6972

7073
#: ../../extending/extending.rst:42
7174
msgid ""
@@ -82,17 +85,17 @@ msgid ""
8285
"is called ``spam``, the C file containing its implementation is called "
8386
":file:`spammodule.c`; if the module name is very long, like ``spammify``, "
8487
"the module name can be just :file:`spammify.c`.)"
85-
msgstr ""
88+
msgstr "一个C扩展模块的文件名可以直接是 模块名.c 或者是 模块名module.c 。第一行应该导入头文件:"
8689

8790
#: ../../extending/extending.rst:58
8891
msgid "The first line of our file can be::"
89-
msgstr ""
92+
msgstr "文件的第一行应该是:"
9093

9194
#: ../../extending/extending.rst:62
9295
msgid ""
9396
"which pulls in the Python API (you can add a comment describing the purpose "
9497
"of the module and a copyright notice if you like)."
95-
msgstr ""
98+
msgstr "这会导入Python API (你可以添加注释来描述模块的目标和版权提示)。"
9699

97100
#: ../../extending/extending.rst:67
98101
msgid ""
@@ -113,13 +116,18 @@ msgid ""
113116
"file does not exist on your system, it declares the functions "
114117
":c:func:`malloc`, :c:func:`free` and :c:func:`realloc` directly."
115118
msgstr ""
119+
"所有用户可见的符号都定义自爱 :file:`Python.h` 中,并拥有前缀 ``Py`` 或 ``PY`` "
120+
",除了那些已经定义在i包准头文件的。为了方便,以及为了让Python解释器应用广泛, ``Python.h`` 也包含了少量标准头文件: "
121+
"``<stdio.h>`` , ``<string.h>`` , ``<errno.h>`` ,和 ``<stdlib.h>`` "
122+
"。如果后面的头文件在你的系统上不存在,还会直接声明函数 :c:func:`malloc` , :c:func:`free` 和 "
123+
":c:func:`realloc` 。"
116124

117125
#: ../../extending/extending.rst:79
118126
msgid ""
119127
"The next thing we add to our module file is the C function that will be "
120128
"called when the Python expression ``spam.system(string)`` is evaluated "
121129
"(we'll see shortly how it ends up being called)::"
122-
msgstr ""
130+
msgstr "下面添加C代码到扩展模块,当调用 \"spam.system(string)\" 时会做出响应:"
123131

124132
#: ../../extending/extending.rst:95
125133
msgid ""
@@ -128,6 +136,8 @@ msgid ""
128136
"the C function. The C function always has two arguments, conventionally "
129137
"named *self* and *args*."
130138
msgstr ""
139+
"有个直接翻译参数列表的方法(例如单独的 ``“ls-l\"``)到要传递给C函数的参数。C函数总是有两个参数,通常名字是 *self* 和 *args*"
140+
" 。"
131141

132142
#: ../../extending/extending.rst:100
133143
msgid ""
@@ -146,6 +156,9 @@ msgid ""
146156
"determine the required types of the arguments as well as the types of the C "
147157
"variables into which to store the converted values. More about this later."
148158
msgstr ""
159+
"args "
160+
"参数是一个指向Python的tuple对象的指针,包含参数。每个tuple子项对应一个调用参数。这些参数也全都是Python对象,所以需要先转换成C值。函数"
161+
" :c:func:`PyArg_ParseTuple()` 检查参数类型并转换成C值。它使用模板字符串检测需要的参数类型。细节在后面讲。"
149162

150163
#: ../../extending/extending.rst:112
151164
msgid ""
@@ -156,10 +169,12 @@ msgid ""
156169
"the calling function can return *NULL* immediately (as we saw in the "
157170
"example)."
158171
msgstr ""
172+
":c:func:`PyArg_ParseTuple` "
173+
"正常返回非零,并已经按照提供的地址存入了各个变量值。如果出错(零)则应该让函数返回NULL以通知解释器出错(有如例子中看到的)。"
159174

160175
#: ../../extending/extending.rst:122
161176
msgid "Intermezzo: Errors and Exceptions"
162-
msgstr ""
177+
msgstr "关于错误和异常"
163178

164179
#: ../../extending/extending.rst:124
165180
msgid ""
@@ -180,7 +195,7 @@ msgstr ""
180195
msgid ""
181196
"The Python API defines a number of functions to set various types of "
182197
"exceptions."
183-
msgstr ""
198+
msgstr "Python API中定义了一些函数来设置这些变量。"
184199

185200
#: ../../extending/extending.rst:137
186201
msgid ""
@@ -190,6 +205,8 @@ msgid ""
190205
"indicates the cause of the error and is converted to a Python string object "
191206
"and stored as the \"associated value\" of the exception."
192207
msgstr ""
208+
"最常用的就是 :c:func:`PyErr_SetString` 。参数是异常对象和C字符串。异常对象一般由像 "
209+
"PyExc_ZeroDivisionError 这样的对象来预定义。C字符串指明异常原因,并最终存储在异常的第一个参数里面。"
193210

194211
#: ../../extending/extending.rst:143
195212
msgid ""
@@ -200,6 +217,9 @@ msgid ""
200217
"and its associated value. You don't need to :c:func:`Py_INCREF` the objects"
201218
" passed to any of these functions."
202219
msgstr ""
220+
"另一个有用的函数是 :c:func:`PyErr_SetFromErrno` ,仅接受一个异常对象,异常描述包含在全局变量 "
221+
":c:data:`errno` 中。最通用的函数还是 :c:func:`PyErr_SetObject` "
222+
",包含两个参数,分别为异常对象和异常描述。你不需要使用 :c:func:`Py_INCREF` 来增加传递到其他函数的参数对象的引用计数。"
203223

204224
#: ../../extending/extending.rst:150
205225
msgid ""
@@ -209,6 +229,8 @@ msgid ""
209229
":c:func:`PyErr_Occurred` to see whether an error occurred in a function "
210230
"call, since you should be able to tell from the return value."
211231
msgstr ""
232+
"你可以通过 :c:func:`PyErr_Occurred` 获知当前异常,返回当前异常对象,如果确实没有则为 *NULL* "
233+
"。一般来说,你在调用函数时不需要调用 :c:func:`PyErr_Occurred` 检查是否发生了异常,你可以直接检查返回值。"
212234

213235
#: ../../extending/extending.rst:156
214236
msgid ""
@@ -223,6 +245,9 @@ msgid ""
223245
"executing Python code and tries to find an exception handler specified by "
224246
"the Python programmer."
225247
msgstr ""
248+
"如果调用更下层函数时出错了,那么本函数返回NULL表示错误,并且整个调用栈中只要有一处调用 :c:func:`PyErr_*` 函数设置异常(通常用 "
249+
"*NULL* 或 ``-1`` "
250+
")就可以。一般来说,首先发现错误的函数应该设置异常。一旦这个错误到达了Python解释器的主循环,则会中断当前执行代码并追究异常。"
226251

227252
#: ../../extending/extending.rst:166
228253
msgid ""
@@ -232,6 +257,8 @@ msgid ""
232257
" can cause information about the cause of the error to be lost: most "
233258
"operations can fail for a variety of reasons.)"
234259
msgstr ""
260+
"(有一种情况下,模块可能依靠其他 PyErr_*() "
261+
"函数给出更加详细的错误信息,并且是正确的。但是按照一般规则,这并不重要,很多操作都会因为种种原因而挂掉。)"
235262

236263
#: ../../extending/extending.rst:172
237264
msgid ""
@@ -242,6 +269,8 @@ msgid ""
242269
"itself (possibly by trying something else, or pretending nothing went "
243270
"wrong)."
244271
msgstr ""
272+
"想要忽略这些函数设置的异常,异常情况必须明确的使用 :c:func:`PyErr_Clear` "
273+
"来清除。只有在C代码想要自己处理异常而不是传给解释器时才这么做。(可能想尝试其他的,或假装出错)。"
245274

246275
#: ../../extending/extending.rst:178
247276
msgid ""
@@ -260,13 +289,15 @@ msgid ""
260289
"positive value or zero for success and ``-1`` for failure, like Unix system "
261290
"calls."
262291
msgstr ""
292+
"还要注意的是 :c:func:`PyArg_ParseTuple` "
293+
"系列函数的异常,返回一个整数状态码是有效的,0是成功,-1是失败,有如Unix系统调用。"
263294

264295
#: ../../extending/extending.rst:188
265296
msgid ""
266297
"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or "
267298
":c:func:`Py_DECREF` calls for objects you have already created) when you "
268299
"return an error indicator!"
269-
msgstr ""
300+
msgstr "最后,小心垃圾情理,也就是 :c:func:`Py_XDECREF` 和 :c:func:`Py_DECREF` 的调用,会返回的异常。"
270301

271302
#: ../../extending/extending.rst:192
272303
msgid ""
@@ -281,13 +312,18 @@ msgid ""
281312
" particular range or must satisfy other conditions, "
282313
":c:data:`PyExc_ValueError` is appropriate."
283314
msgstr ""
315+
"选择抛出哪个异常完全是你的个人爱好了。有一系列的C对象代表了内置Python异常,例如 "
316+
":c:data:`PyExc_ZeroDivisionError` ,你可以直接使用。当然,你可能选择更合适的异常,不过别使用 "
317+
":c:data:`PyExc_TypeError` 告知文件打开失败(有个更合适的 :c:data:`PyExc_IOError` "
318+
")。如果参数列表有误, :c:func:`PyArg_ParseTuple` 通常会抛出 :c:data:`PyExc_TypeError` "
319+
"。如果参数值域有误, PyExc_ValueError 更合适一些。"
284320

285321
#: ../../extending/extending.rst:202
286322
msgid ""
287323
"You can also define a new exception that is unique to your module. For this,"
288324
" you usually declare a static object variable at the beginning of your "
289325
"file::"
290-
msgstr ""
326+
msgstr "你也可以为你的模块定义一个唯一的新异常。需要在文件前部声明一个静态对象变量,如:"
291327

292328
#: ../../extending/extending.rst:207
293329
msgid ""
@@ -303,6 +339,9 @@ msgid ""
303339
"class being :exc:`Exception` (unless another class is passed in instead of "
304340
"*NULL*), described in :ref:`bltin-exceptions`."
305341
msgstr ""
342+
"注意实际的Python异常名字是 :exc:`spam.error` 。 :c:func:`PyErr_NewException` 函数使用 "
343+
":exc:`Exception` 为基类创建一个类(除非是使用另外一个类替代 *NULL* )。描述参考 :ref:`bltin-exceptions`"
344+
" 。"
306345

307346
#: ../../extending/extending.rst:230
308347
msgid ""
@@ -314,22 +353,24 @@ msgid ""
314353
"dangling pointer, C code which raises the exception could cause a core dump "
315354
"or other unintended side effects."
316355
msgstr ""
356+
"同样注意的是创建类保存了 :c:data:`SpamError` 的一个引用,这是有意的。为了防止被垃圾回收掉,否则 "
357+
":c:data:`SpamError` 随时会成为野指针。"
317358

318359
#: ../../extending/extending.rst:237
319360
msgid ""
320361
"We discuss the use of ``PyMODINIT_FUNC`` as a function return type later in "
321362
"this sample."
322-
msgstr ""
363+
msgstr "一会讨论 ``PyMODINIT_FUNC`` 作为函数返回类型的用法。"
323364

324365
#: ../../extending/extending.rst:240
325366
msgid ""
326367
"The :exc:`spam.error` exception can be raised in your extension module using"
327368
" a call to :c:func:`PyErr_SetString` as shown below::"
328-
msgstr ""
369+
msgstr ":exc:`spam.error` 异常可以在扩展模块中抛出,通过 :c:func:`PyErr_SetString` 函数调用,如下:"
329370

330371
#: ../../extending/extending.rst:263
331372
msgid "Back to the Example"
332-
msgstr ""
373+
msgstr "回到例子"
333374

334375
#: ../../extending/extending.rst:265
335376
msgid ""

faq/windows.po

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ msgid ""
256256
"it is typically installed in ``C:\\Windows\\System``. *NN* is the Python "
257257
"version, a number such as \"33\" for Python 3.3."
258258
msgstr ""
259+
"请 _不要_ 直接在你的 .exe 文件中内置 Python 。在 Windows 上, Python 必须是一个 DLL "
260+
",这样才可以处理导入的本身就是 DLL 的模块。(这是第一个未记录的关键事实。)相反,链接到 :file:`python{NN}.dll` "
261+
";它通常安装在 ``C:\\Windows\\System`` 中。 *NN* 是 Python 版本,如数字“33”代表 Python 3.3 。"
259262

260263
#: ../../faq/windows.rst:179
261264
msgid ""
@@ -265,6 +268,9 @@ msgid ""
265268
"the so-called \"import lib\" corresponding to :file:`python{NN}.dll`. It "
266269
"merely defines symbols for the linker.)"
267270
msgstr ""
271+
"你可以通过两种不同的方式链接到 Python 。加载时链接意味着链接到 :file:`python{NN}.lib` ,而运行时链接意味着链接 "
272+
":file:`python{NN}.dll` 。(一般说明: :file:`python {NN}.lib` 是所谓的“import lib”,对应于 "
273+
":file:`python{NN}.dll` 。它只定义了链接器的符号。)"
268274

269275
#: ../../faq/windows.rst:185
270276
msgid ""
@@ -276,12 +282,16 @@ msgid ""
276282
" these pointers transparent to any C code that calls routines in Python's C "
277283
"API."
278284
msgstr ""
285+
"运行时链接极大地简化了链接选项,一切都在运行时发生。你的代码必须使用 Windows 的 ``LoadLibraryEx()`` 程序加载 "
286+
":file:`python{NN}.dll` 。代码还必须使用使用 Windows 的 ``GetProcAddress()`` 例程获得的指针访问 "
287+
":file:`python{NN}.dll` 中程序和数据(即 Python 的 C API )。宏可以使这些指针对任何调用 Python C API "
288+
"中的例程的 C 代码都是透明的。"
279289

280290
#: ../../faq/windows.rst:192
281291
msgid ""
282292
"Borland note: convert :file:`python{NN}.lib` to OMF format using "
283293
"Coff2Omf.exe first."
284-
msgstr ""
294+
msgstr "Borland 提示:首先使用 Coff2Omf.exe 将 :file:`python{NN}.lib` 转换为 OMF 格式。"
285295

286296
#: ../../faq/windows.rst:197
287297
msgid ""
@@ -291,6 +301,8 @@ msgid ""
291301
"link *into* your .exe file (!) You do _not_ have to create a DLL file, and "
292302
"this also simplifies linking."
293303
msgstr ""
304+
"如果你使用 SWIG ,很容易创建一个 Python “扩展模块”,它将使应用程序的数据和方法可供 Python "
305+
"使用。SWIG将为你处理所有蹩脚的细节。结果是你将链接到 .exe 文件 *中* 的C代码 (!) 你不必创建 DLL 文件,这也简化了链接。"
294306

295307
#: ../../faq/windows.rst:203
296308
msgid ""
@@ -300,19 +312,22 @@ msgid ""
300312
"classes, as you should, the init function will be called initleoc(). This "
301313
"initializes a mostly hidden helper class used by the shadow class."
302314
msgstr ""
315+
"SWIG 将创建一个 init 函数(一个 C 函数),其名称取决于扩展模块的名称。例如,如果模块的名称是 leo ,则 init 函数将被称为 "
316+
"initleo() 。 如果您使用 SWIG 阴影类,则 init 函数将被称为 initleoc() 。这初始化了一个由阴影类使用的隐藏辅助类。"
303317

304318
#: ../../faq/windows.rst:209
305319
msgid ""
306320
"The reason you can link the C code in step 2 into your .exe file is that "
307321
"calling the initialization function is equivalent to importing the module "
308322
"into Python! (This is the second key undocumented fact.)"
309323
msgstr ""
324+
"你可以将步骤 2 中的 C 代码链接到 .exe 文件的原因是调用初始化函数等同于将模块导入 Python ! (这是第二个关键的未记载事实。)"
310325

311326
#: ../../faq/windows.rst:213
312327
msgid ""
313328
"In short, you can use the following code to initialize the Python "
314329
"interpreter with your extension module."
315-
msgstr ""
330+
msgstr "简而言之,你可以用以下代码使用扩展模块初始化 Python 解释器。"
316331

317332
#: ../../faq/windows.rst:224
318333
msgid ""

0 commit comments

Comments
 (0)