@@ -115,14 +115,14 @@ msgstr ""
115115
116116#: ../../library/configparser.rst:140
117117msgid "Supported Datatypes"
118- msgstr ""
118+ msgstr "支持的数据类型 "
119119
120120#: ../../library/configparser.rst:142
121121msgid ""
122122"Config parsers do not guess datatypes of values in configuration files, "
123123"always storing them internally as strings. This means that if you need "
124124"other datatypes, you should convert on your own:"
125- msgstr ""
125+ msgstr "配置解析器并不会猜测配置文件中值的类型,而总是将它们在内部存储为字符串。 这意味着如果你需要其他数据类型,你应当自己来转换: "
126126
127127#: ../../library/configparser.rst:153
128128msgid ""
@@ -134,6 +134,10 @@ msgid ""
134134"and recognizes Boolean values from ``'yes'``/``'no'``, ``'on'``/``'off'``, "
135135"``'true'``/``'false'`` and ``'1'``/``'0'`` [1]_. For example:"
136136msgstr ""
137+ "由于这种任务十分常用,配置解析器提供了一系列便捷的获取方法来处理整数、浮点数和布尔值。 最后一个类型的处理最为有趣,因为简单地将值传给 "
138+ "``bool()`` 是没有用的,``bool('False')`` 仍然会是 ``True``。 为解决这个问题配置解析器还提供了 "
139+ ":meth:`~ConfigParser.getboolean`。 这个方法对大小写不敏感并可识别 ``'yes'``/``'no'``, "
140+ "``'on'``/``'off'``, ``'true'``/``'false'`` 和 ``'1'``/``'0'`` [1]_ 等布尔值。 例如:"
137141
138142#: ../../library/configparser.rst:170
139143msgid ""
@@ -142,16 +146,19 @@ msgid ""
142146"methods. You can register your own converters and customize the provided "
143147"ones. [1]_"
144148msgstr ""
149+ "除了 :meth:`~ConfigParser.getboolean`,配置解析器还提供了同类的 "
150+ ":meth:`~ConfigParser.getint` 和 :meth:`~ConfigParser.getfloat` 方法。 "
151+ "你可以注册你自己的转换器并或是定制已提供的转换器。 [1]_"
145152
146153#: ../../library/configparser.rst:176
147154msgid "Fallback Values"
148- msgstr ""
155+ msgstr "回退值 "
149156
150157#: ../../library/configparser.rst:178
151158msgid ""
152159"As with a dictionary, you can use a section's :meth:`get` method to provide "
153160"fallback values:"
154- msgstr ""
161+ msgstr "与字典类似,你可以使用某个小节的 :meth:`get` 方法来提供回退值: "
155162
156163#: ../../library/configparser.rst:191
157164msgid ""
@@ -161,6 +168,8 @@ msgid ""
161168"``'topsecret.server.com'``, we will always get the default, even if we "
162169"specify a fallback:"
163170msgstr ""
171+ "请注意默认值会优先于回退值。 例如,在我们的示例中 ``'CompressionLevel'`` 键仅在 ``'DEFAULT'`` 小节被指定。 "
172+ "如果你尝试在 ``'topsecret.server.com'`` 小节获取它,我们将总是获取到默认值,即使我们指定了一个回退值:"
164173
165174#: ../../library/configparser.rst:202
166175msgid ""
@@ -169,17 +178,21 @@ msgid ""
169178"compatibility. When using this method, a fallback value can be provided via"
170179" the ``fallback`` keyword-only argument:"
171180msgstr ""
181+ "还需要注意的一点是解析器层级的 :meth:`get` 方法提供了自定义的更复杂接口,它被维护用于向下兼容。 当使用此方法时,回退值可以通过 "
182+ "``fallback`` 仅限关键字参数来提供:"
172183
173184#: ../../library/configparser.rst:213
174185msgid ""
175186"The same ``fallback`` argument can be used with the "
176187":meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat` and "
177188":meth:`~ConfigParser.getboolean` methods, for example:"
178189msgstr ""
190+ "同样的 ``fallback`` 参数也可在 :meth:`~ConfigParser.getint`, "
191+ ":meth:`~ConfigParser.getfloat` 和 :meth:`~ConfigParser.getboolean` 方法中使用,例如:"
179192
180193#: ../../library/configparser.rst:229
181194msgid "Supported INI File Structure"
182- msgstr ""
195+ msgstr "受支持的 INI 文件结构 "
183196
184197#: ../../library/configparser.rst:231
185198msgid ""
@@ -193,28 +206,33 @@ msgid ""
193206"parser's mode, blank lines may be treated as parts of multiline values or "
194207"ignored."
195208msgstr ""
209+ "配置文件是由小节组成的,每个小节都有一个 ``[section]`` 标头,加上多个由特定字符串 (默认为 ``=`` 或 ``:`` [1]_) "
210+ "分隔的键/值条目。 默认情况下小节名对大小写敏感而键对大小写不敏感 [1]_。 键和值开头和末尾的空格会被移除。 "
211+ "值可以被省略,在此情况下键/值分隔符也可以被省略。 值还可以跨越多行,只要其他行带有比值的第一行更深的缩进。 "
212+ "依据解析器的具体模式,空白行可能被视为多行值的组成部分也可能被忽略。"
196213
197214#: ../../library/configparser.rst:240
198215msgid ""
199216"Configuration files may include comments, prefixed by specific characters "
200217"(``#`` and ``;`` by default [1]_). Comments may appear on their own on an "
201218"otherwise empty line, possibly indented. [1]_"
202219msgstr ""
220+ "配置文件可以包含注释,要带有指定字符前缀 (默认为 ``#`` 和 ``;`` [1]_)。 注释可以单独出现于原本的空白行,并可使用缩进。 [1]_"
203221
204222#: ../../library/configparser.rst:244 ../../library/configparser.rst:307
205223msgid "For example:"
206224msgstr "例如:"
207225
208226#: ../../library/configparser.rst:292
209227msgid "Interpolation of values"
210- msgstr ""
228+ msgstr "值的插值 "
211229
212230#: ../../library/configparser.rst:294
213231msgid ""
214232"On top of the core functionality, :class:`ConfigParser` supports "
215233"interpolation. This means values can be preprocessed before returning them "
216234"from ``get()`` calls."
217- msgstr ""
235+ msgstr "在核心功能之上,:class:`ConfigParser` 还支持插值。 这意味着值可以在被 ``get()`` 调用返回之前进行预处理。 "
218236
219237#: ../../library/configparser.rst:302
220238msgid ""
@@ -223,6 +241,8 @@ msgid ""
223241"or values in the special default section [1]_. Additional default values "
224242"can be provided on initialization."
225243msgstr ""
244+ "默认实现由 :class:`ConfigParser` 来使用。 它允许值包含引用了相同小节中其他值或者特殊的默认小节中的值的格式字符串 [1]_。 "
245+ "额外的默认值可以在初始化时提供。"
226246
227247#: ../../library/configparser.rst:319
228248msgid ""
0 commit comments