33# This file is distributed under the same license as the Python package.
44# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55#
6+ # Translators:
7+ # Rafael Fontenelle <rffontenelle@gmail.com>, 2025
8+ #
69#, fuzzy
710msgid ""
811msgstr ""
912"Project-Id-Version :Python 3.9\n "
1013"Report-Msgid-Bugs-To :\n "
11- "POT-Creation-Date :2025-07-25 19:10 +0000\n "
14+ "POT-Creation-Date :2025-09-13 17:35 +0000\n "
1215"PO-Revision-Date :2025-07-18 19:17+0000\n "
16+ "Last-Translator :Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n "
1317"Language-Team :Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
1418"MIME-Version :1.0\n "
1519"Content-Type :text/plain; charset=UTF-8\n "
@@ -19,7 +23,7 @@ msgstr ""
1923
2024#: ../../extending/windows.rst:8
2125msgid "Building C and C++ Extensions on Windows"
22- msgstr ""
26+ msgstr "在 Windows 上构建 C 和 C++ 扩展 "
2327
2428#: ../../extending/windows.rst:10
2529msgid ""
@@ -30,6 +34,9 @@ msgid ""
3034"programmer interested in producing software which can be successfully built "
3135"on both Unix and Windows."
3236msgstr ""
37+ "这一章简要介绍了如何使用 Microsoft Visual C++ 创建 Python 的 Windows "
38+ "扩展模块,然后再提供有关其工作机理的详细背景信息。 这些说明材料同时适用于 Windows 程序员学习构建 Python 扩展以及 Unix "
39+ "程序员学习如何生成在 Unix 和 Windows 上均能成功构建的软件。"
3340
3441#: ../../extending/windows.rst:17
3542msgid ""
@@ -38,6 +45,8 @@ msgid ""
3845"still need the C compiler that was used to build Python; typically Microsoft"
3946" Visual C++."
4047msgstr ""
48+ "鼓励模块作者使用 distutils 方式来构建扩展模块,而不使用本节所描述的方式。 你仍将需要使用 C 编译器来构建 Python;通常为 "
49+ "Microsoft Visual C++。"
4150
4251#: ../../extending/windows.rst:24
4352msgid ""
@@ -48,10 +57,12 @@ msgid ""
4857"working with. For example, if you are using Python 2.2.1, ``XY`` will "
4958"actually be ``22``."
5059msgstr ""
60+ "这一章提及了多个包括已编码 Python 版本号的文件名。 这些文件名以显示为 ``XY`` 的版本号来代表;在实践中,``'X'`` 将为你所使用的 "
61+ "Python 发布版的主版本号而 ``'Y'`` 将为次版本号。 例如,如果你所使用的是 Python 2.2.1,``XY`` 将为 ``22``。"
5162
5263#: ../../extending/windows.rst:34
5364msgid "A Cookbook Approach"
54- msgstr ""
65+ msgstr "菜谱式说明 "
5566
5667#: ../../extending/windows.rst:36
5768msgid ""
@@ -64,17 +75,22 @@ msgid ""
6475"project file for the :source:`winsound <PCbuild/winsound.vcxproj>` standard "
6576"library module."
6677msgstr ""
78+ "在 Windows 和 Unix 上构建扩展模块都有两种方式:使用 :mod:`distutils` 包来控制构建过程,或者全手动操作。 "
79+ "distutils 方式适用于大多数扩展;使用 :mod:`distutils` 构建和打包扩展模块的文档见 :ref:`distutils-"
80+ "index`。 如果你发现你确实需要手动操作,那么研究一下 :source:`winsound <PCbuild/winsound.vcxproj>` "
81+ "标准库模块的项目文件可能会很有帮助。"
6782
6883#: ../../extending/windows.rst:48
6984msgid "Differences Between Unix and Windows"
70- msgstr ""
85+ msgstr "Unix 和 Windows 之间的差异 "
7186
7287#: ../../extending/windows.rst:53
7388msgid ""
7489"Unix and Windows use completely different paradigms for run-time loading of "
7590"code. Before you try to build a module that can be dynamically loaded, be "
7691"aware of how your system works."
7792msgstr ""
93+ "Unix 和 Windows 对于代码的运行时加载使用了完全不同的范式。 在你尝试构建可动态加载的模块之前,要先了解你所用系统是如何工作的。"
7894
7995#: ../../extending/windows.rst:57
8096msgid ""
@@ -85,6 +101,8 @@ msgid ""
85101"actual locations in the program where the functions and data are placed in "
86102"memory. This is basically a link operation."
87103msgstr ""
104+ "在 Unix 中,一个共享对象 (:file:`.so`) 文件中包含将由程序来使用的代码,也包含在程序中可被找到的函数名称和数据。 "
105+ "当文件被合并到程序中时,对在文件代码中这些函数和数据的全部引用都会被改为指向程序中函数和数据在内存中所放置的实际位置。 这基本上是一个链接操作。"
88106
89107#: ../../extending/windows.rst:64
90108msgid ""
@@ -95,6 +113,8 @@ msgid ""
95113" and the lookup table is modified at runtime to point to the functions and "
96114"data."
97115msgstr ""
116+ "在 Windows 中,一个动态链接库 (:file:`.dll`) 文件中没有悬挂的引用。 而是通过一个查找表执行对函数或数据的访问。 因此在运行时 "
117+ "DLL 代码不必在运行时进行修改;相反地,代码已经使用了 DLL 的查找表,并且在运行时查找表会被修改以指向特定的函数和数据。"
98118
99119#: ../../extending/windows.rst:70
100120msgid ""
@@ -105,6 +125,9 @@ msgid ""
105125"object files in the libraries; if it finds it, it will include all the code "
106126"from that object file."
107127msgstr ""
128+ "在 Unix 中,只存在一种库文件 (:file:`.a`),它包含来自多个对象文件 (:file:`.o`) 的代码。 在创建共享对象文件 "
129+ "(:file:`.so`) 的链接阶段,链接器可能会发现它不知道某个标识符是在哪里定义的。 "
130+ "链接器将在各个库的对象文件中查找它;如果找到了它,链接器将会包括来自该对象文件的所有代码。"
108131
109132#: ../../extending/windows.rst:76
110133msgid ""
@@ -119,6 +142,10 @@ msgid ""
119142"which will need to be used for all future DLLs that depend on the symbols in"
120143" the application or DLL."
121144msgstr ""
145+ "在 Windows 中,存在两种库类型,静态库和导入库 (扩展名都是 :file:`.lib`)。 静态库类似于 Unix 的 :file:`.a` "
146+ "文件;它包含在必要时可被包括的代码。 导入库基本上仅用于让链接器能确保特定标识符是合法的,并且将在 DLL 被加载时出现于程序中。 "
147+ "这样链接器可使用来自导入库的信息构建查找表以便使用未包括在 DLL 中的标识符。 当一个应用程序或 DLL "
148+ "被链接时,可能会生成一个导入库,它将需要被用于应用程序或 DLL 中未来所有依赖于这些符号的 DLL。"
122149
123150#: ../../extending/windows.rst:86
124151msgid ""
@@ -131,6 +158,10 @@ msgid ""
131158"code; it just contains information which will be used at runtime to access "
132159"A's code."
133160msgstr ""
161+ "假设你正在编译两个动态加载模块 B 和 C,它们应当共享另一个代码块 A。 在 Unix 上,你 *不应* 将 :file:`A.a` 传给链接器作为 "
162+ ":file:`B.so` 和 :file:`C.so`;那会导致它被包括两次,这样 B 和 C 将分别拥有它们自己的副本。 在 Windows 上,编译"
163+ " :file:`A.dll` 将同时编译 :file:`A.lib`。 你 *应当* 将 :file:`A.lib` 传给链接器用于 B 和 C。 "
164+ ":file:`A.lib` 并不包含代码;它只包含将在运行时被用于访问 A 的代码的信息。"
134165
135166#: ../../extending/windows.rst:94
136167msgid ""
@@ -139,23 +170,29 @@ msgid ""
139170"On Unix, linking with a library is more like ``from spam import *``; it does"
140171" create a separate copy."
141172msgstr ""
173+ "在 Windows 上,使用导入库有点像是使用 ``import spam``;它让你可以访问 spam 中的名称,但并不会创建一个单独副本。 在 "
174+ "Unix 上,链接到一个库更像是 ``from spam import *``;它会创建一个单独副本。"
142175
143176#: ../../extending/windows.rst:103
144177msgid "Using DLLs in Practice"
145- msgstr ""
178+ msgstr "DLL 的实际使用 "
146179
147180#: ../../extending/windows.rst:108
148181msgid ""
149182"Windows Python is built in Microsoft Visual C++; using other compilers may "
150183"or may not work. The rest of this section is MSVC++ specific."
151184msgstr ""
185+ "Windows Python 是在 Microsoft Visual C++ 中构建的;使用其他编译器可能会也可能不会工作。本节的其余部分是针对 "
186+ "MSVC++ 的。"
152187
153188#: ../../extending/windows.rst:111
154189msgid ""
155190"When creating DLLs in Windows, you must pass :file:`pythonXY.lib` to the "
156191"linker. To build two DLLs, spam and ni (which uses C functions found in "
157192"spam), you could use these commands::"
158193msgstr ""
194+ "当在 Windows 中创建 DLL 时,你必须将 :file:`pythonXY.lib` 传给链接器。 要编译两个 DLL,spam 和 ni "
195+ "(会使用 spam 中找到的 C 函数),你应当使用以下命令::"
159196
160197#: ../../extending/windows.rst:118
161198msgid ""
@@ -164,13 +201,18 @@ msgid ""
164201"functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find"
165202" the Python code thanks to :file:`pythonXY.lib`."
166203msgstr ""
204+ "第一条命令创建了三个文件: :file:`spam.obj`, :file:`spam.dll` 和 :file:`spam.lib`。 "
205+ ":file:`Spam.dll` 不包含任何 Python 函数 (例如 :c:func:`PyArg_ParseTuple`),但它通过 "
206+ ":file:`pythonXY.lib` 可以知道如何找到所需的 Python 代码。"
167207
168208#: ../../extending/windows.rst:123
169209msgid ""
170210"The second command created :file:`ni.dll` (and :file:`.obj` and "
171211":file:`.lib`), which knows how to find the necessary functions from spam, "
172212"and also from the Python executable."
173213msgstr ""
214+ "第二条命令创建了 :file:`ni.dll` (以及 :file:`.obj` 和 :file:`.lib`),它知道如何从 spam 以及 "
215+ "Python 可执行文件中找到所需的函数。"
174216
175217#: ../../extending/windows.rst:127
176218msgid ""
@@ -179,6 +221,9 @@ msgid ""
179221"say ``_declspec(dllexport)``, as in ``void _declspec(dllexport) "
180222"initspam(void)`` or ``PyObject _declspec(dllexport) *NiGetSpamData(void)``."
181223msgstr ""
224+ "不是每个标识符都会被导出到查找表。 如果你想要任何其他模块(包括 Python)都能看到你的标识符,你必须写上 "
225+ "``_declspec(dllexport)``,就如在 ``void _declspec(dllexport) initspam(void)`` 或 "
226+ "``PyObject _declspec(dllexport) *NiGetSpamData(void)`` 中一样。"
182227
183228#: ../../extending/windows.rst:132
184229msgid ""
@@ -187,3 +232,5 @@ msgid ""
187232"the Project Settings dialog, Link tab, to specify *ignore default "
188233"libraries*. Add the correct :file:`msvcrtxx.lib` to the list of libraries."
189234msgstr ""
235+ "Developer Studio 将加入大量你并不真正需要的导入库,使你的可执行文件大小增加 100K。 "
236+ "要摆脱它们,请使用项目设置对话框的链接选项卡指定 *忽略默认库*。 将正确的 :file:`msvcrtxx.lib` 添加到库列表中。"