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

Skip to content

Commit f6aae2a

Browse files
[po] auto sync
1 parent a885512 commit f6aae2a

3 files changed

Lines changed: 6892 additions & 6838 deletions

File tree

howto/logging-cookbook.po

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# 浩听 王 <[email protected]>, 2019
1111
# Shengjing Zhu <[email protected]>, 2019
1212
# Meng Du <[email protected]>, 2020
13-
# Freesand Leo <[email protected]>, 2021
1413
# Dai Xu <[email protected]>, 2021
14+
# Freesand Leo <[email protected]>, 2021
1515
#
1616
#, fuzzy
1717
msgid ""
@@ -20,7 +20,7 @@ msgstr ""
2020
"Report-Msgid-Bugs-To: \n"
2121
"POT-Creation-Date: 2021-01-01 05:02+0000\n"
2222
"PO-Revision-Date: 2017-02-16 17:45+0000\n"
23-
"Last-Translator: Dai Xu <daixu61@hotmail.com>, 2021\n"
23+
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2021\n"
2424
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2525
"MIME-Version: 1.0\n"
2626
"Content-Type: text/plain; charset=UTF-8\n"
@@ -1145,14 +1145,14 @@ msgid ""
11451145
"You can then specify, in a logging configuration passed to "
11461146
":func:`dictConfig`, that a logging handler be created by calling this "
11471147
"function::"
1148-
msgstr ""
1148+
msgstr "然后,你可以在传给 :func:`dictConfig` 的日志配置中指定通过调用此函数来创建日志处理程序::"
11491149

11501150
#: ../../howto/logging-cookbook.rst:1870
11511151
msgid ""
11521152
"In this example I am setting the ownership using the ``pulse`` user and "
11531153
"group, just for the purposes of illustration. Putting it together into a "
11541154
"working script, ``chowntest.py``::"
1155-
msgstr ""
1155+
msgstr "出于演示目的,以下示例设置用户和用户组为 ``pulse``。代码置于一个可运行的脚本文件 ``chowntest.py`` 中:"
11561156

11571157
#: ../../howto/logging-cookbook.rst:1917
11581158
msgid "To run this, you will probably need to run as ``root``:"
@@ -1166,12 +1166,15 @@ msgid ""
11661166
"or later. With pre-3.3 versions, you would need to implement the actual "
11671167
"ownership change using e.g. :func:`os.chown`."
11681168
msgstr ""
1169+
"请注意此示例用的是 Python 3.3,因为 :func:`shutil.chown` 是从此版本开始出现的。 此方式应当适用于任何支持 "
1170+
":func:`dictConfig` 的 Python 版本 —— 例如 Python 2.7, 3.2 或更新的版本。 对于 3.3 "
1171+
"之前的版本,你应当使用 :func:`os.chown` 之类的函数来实现实际的所有权修改。"
11691172

11701173
#: ../../howto/logging-cookbook.rst:1933
11711174
msgid ""
11721175
"In practice, the handler-creating function may be in a utility module "
11731176
"somewhere in your project. Instead of the line in the configuration::"
1174-
msgstr ""
1177+
msgstr "实际应用中,handler 的创建函数可能位于项目的工具模块中。以下配置:"
11751178

11761179
#: ../../howto/logging-cookbook.rst:1938
11771180
msgid "you could use e.g.::"
@@ -1185,24 +1188,29 @@ msgid ""
11851188
"callable is resolved by :func:`dictConfig` from the ``ext://`` "
11861189
"specification."
11871190
msgstr ""
1191+
"这里的 ``project.util`` 可以换成函数所在包的实际名称。 在上述的可用脚本中,应该可以使用 "
1192+
"``'ext://__main__.owned_file_handler'``。 在这里,实际的可调用对象是由 :func:`dictConfig` 从"
1193+
" ``ext://`` 说明中解析出来的。"
11881194

11891195
#: ../../howto/logging-cookbook.rst:1947
11901196
msgid ""
11911197
"This example hopefully also points the way to how you could implement other "
11921198
"types of file change - e.g. setting specific POSIX permission bits - in the "
11931199
"same way, using :func:`os.chmod`."
1194-
msgstr ""
1200+
msgstr "上述示例还指明了其他的文件修改类型的实现方案 —— 比如同样利用 :func:`os.chmod` 设置 POSIX 访问权限位。"
11951201

11961202
#: ../../howto/logging-cookbook.rst:1951
11971203
msgid ""
11981204
"Of course, the approach could also be extended to types of handler other "
11991205
"than a :class:`~logging.FileHandler` - for example, one of the rotating file"
12001206
" handlers, or a different type of handler altogether."
12011207
msgstr ""
1208+
"当然,以上做法也可以扩展到 :class:`~logging.FileHandler` 之外的其他类型的 handler ——比如某个轮换文件 "
1209+
"handler,或类型完全不同的其他 handler。"
12021210

12031211
#: ../../howto/logging-cookbook.rst:1961
12041212
msgid "Using particular formatting styles throughout your application"
1205-
msgstr ""
1213+
msgstr "生效于整个应用程序的格式化样式"
12061214

12071215
#: ../../howto/logging-cookbook.rst:1963
12081216
msgid ""
@@ -1214,6 +1222,10 @@ msgid ""
12141222
"to logs, and is completely orthogonal to how an individual logging message "
12151223
"is constructed."
12161224
msgstr ""
1225+
"在 Python 3.2 中,:class:`~logging.Formatter` 增加了一个 ``style`` 关键字形参,它默认为 ``%`` "
1226+
"以便向下兼容,但是允许采用 ``{`` 或 ``{TX-PL-LABEL}#x60;`` 来支持 :meth:`str.format` 和 "
1227+
":class:`string.Template` 所支持的格式化方式。 "
1228+
"请注意此形参控制着用用于最终输出到日志的日志消息格式,并且与单独日志消息的构造方式完全无关。"
12171229

12181230
#: ../../howto/logging-cookbook.rst:1970
12191231
msgid ""
@@ -1230,22 +1242,27 @@ msgid ""
12301242
"logging calls which are out there in existing code will be using %-format "
12311243
"strings."
12321244
msgstr ""
1245+
"日志函数(:meth:`~Logger.debug`, :meth:`~Logger.info` "
1246+
"等)只会读取位置参数获取日志信息本身,而关键字参数仅用于确定日志函数的工作选项(比如关键字参数 ``exc_info`` "
1247+
"表示应将跟踪信息记入日志,关键字参数 ``extra`` 则给出了需加入日志的额外上下文信息)。所以不能直接使用 :meth:`str.format` "
1248+
"或 :class:`string.Template` 这种语法进行日志调用,因为日志包在内部使用 %-f "
1249+
"格式来合并格式串和可变参数。因为尚需保持向下兼容,这一点不会改变,已有代码中的所有日志调用都将采用 %-f 格式串。"
12331250

12341251
#: ../../howto/logging-cookbook.rst:1982
12351252
msgid ""
12361253
"There have been suggestions to associate format styles with specific "
12371254
"loggers, but that approach also runs into backward compatibility problems "
12381255
"because any existing code could be using a given logger name and using "
12391256
"%-formatting."
1240-
msgstr ""
1257+
msgstr "有人建议将格式化样式与特定的日志对象进行关联,但其实也会遇到向下兼容的问题,因为已有代码可能用到了某日志对象并采用了 %-f 格式串。"
12411258

12421259
#: ../../howto/logging-cookbook.rst:1986
12431260
msgid ""
12441261
"For logging to work interoperably between any third-party libraries and your"
12451262
" code, decisions about formatting need to be made at the level of the "
12461263
"individual logging call. This opens up a couple of ways in which alternative"
12471264
" formatting styles can be accommodated."
1248-
msgstr ""
1265+
msgstr "为了让第三方库和自编代码都能够交互使用日志功能,需要决定在单次日志记录调用级别采用什么格式。于是就出现了其他几种格式化样式方案。 "
12491266

12501267
#: ../../howto/logging-cookbook.rst:1993
12511268
msgid "Using LogRecord factories"
@@ -1265,16 +1282,22 @@ msgid ""
12651282
" code. Care should also be taken to call ``str(self.msg)``, just as the base"
12661283
" implementation does."
12671284
msgstr ""
1285+
"在 Python 3.2 中,伴随着 :class:`~logging.Formatter` 的上述变化,logging 包增加了允许用户使用 "
1286+
":func:`setLogRecordFactory` 函数来。设置自己的 :class:`LogRecord` 子类的功能。 "
1287+
"你可以使用此功能来设置自己的 :class:`LogRecord` 子类,它会通过重载 :meth:`~LogRecord.getMessage` "
1288+
"方法来完成适当的操作。 ``msg % args`` "
1289+
"格式化是在此方法的基类实现中进行的,你可以在那里用你自己的格式化操作来替换;但是,你应当注意要支持全部的格式化样式并允许将 %-formatting "
1290+
"作为默认样式,以确保与其他代码进行配合。 还应当注意调用 ``str(self.msg)``,正如基类实现所做的一样。"
12681291

12691292
#: ../../howto/logging-cookbook.rst:2006
12701293
msgid ""
12711294
"Refer to the reference documentation on :func:`setLogRecordFactory` and "
12721295
":class:`LogRecord` for more information."
1273-
msgstr ""
1296+
msgstr "更多信息请参阅 :func:`setLogRecordFactory` 和 :class:`LogRecord` 的参考文档。"
12741297

12751298
#: ../../howto/logging-cookbook.rst:2011
12761299
msgid "Using custom message objects"
1277-
msgstr ""
1300+
msgstr "自定义日志信息对象的使用"
12781301

12791302
#: ../../howto/logging-cookbook.rst:2013
12801303
msgid ""
@@ -1285,6 +1308,8 @@ msgid ""
12851308
":func:`str` on that object to get the actual format string. Consider the "
12861309
"following two classes::"
12871310
msgstr ""
1311+
"另一种方案可能更为简单,可以利用 {}- 和 $- 格式构建自己的日志消息。大家或许还记得(来自 :ref:`arbitrary-object-"
1312+
"messages`),可以用任意对象作为日志信息的格式串,日志包将调用该对象上 :func:`str` 获取实际的格式串。看下以下两个类:"
12881313

12891314
#: ../../howto/logging-cookbook.rst:2038
12901315
msgid ""
@@ -1296,16 +1321,19 @@ msgid ""
12961321
"alias such as ``M`` or ``_`` for the message (or perhaps ``__``, if you are "
12971322
"using ``_`` for localization)."
12981323
msgstr ""
1324+
"以上两个类均都可用于替代格式串,以便用 {}- 或 $-formatting 构建实际的“日志信息”部分,此部分将出现在格式化后的日志输出中,替换 "
1325+
"%(message)s 、“{message}”或“$message”。每次要写入日志时都使用类名,如果觉得使用不便,可以采用 ``M`` 或 "
1326+
"``_`` 之类的别名(如果将 ``_`` 用于本地化操作,则可用 ``__``)。"
12991327

13001328
#: ../../howto/logging-cookbook.rst:2046
13011329
msgid ""
13021330
"Examples of this approach are given below. Firstly, formatting with "
13031331
":meth:`str.format`::"
1304-
msgstr ""
1332+
msgstr "下面给出示例。 首先用 :meth:`str.format` 进行格式化:"
13051333

13061334
#: ../../howto/logging-cookbook.rst:2060
13071335
msgid "Secondly, formatting with :class:`string.Template`::"
1308-
msgstr ""
1336+
msgstr "然后,用 :class:`string.Template` 格式化:"
13091337

13101338
#: ../../howto/logging-cookbook.rst:2067
13111339
msgid ""
@@ -1318,6 +1346,9 @@ msgid ""
13181346
"sugar for a constructor call to one of the ``XXXMessage`` classes shown "
13191347
"above."
13201348
msgstr ""
1349+
"值得注意的是,上述做法对性能并没什么影响:格式化过程其实不是在日志调用时发生的,而是在日志信息即将由 handler "
1350+
"输出到日志时发生。因此,唯一可能让人困惑的稍不寻常的地方,就是包裹在格式串和参数外面的括号,而不是格式串。因为 __ 符号只是对 "
1351+
"``XXXMessage`` 类的构造函数调用的语法糖。"
13211352

13221353
#: ../../howto/logging-cookbook.rst:2081
13231354
msgid "Configuring filters with :func:`dictConfig`"
@@ -1337,17 +1368,23 @@ msgid ""
13371368
"provide any callable which returns a :class:`~logging.Filter` instance). "
13381369
"Here is a complete example::"
13391370
msgstr ""
1371+
"用 :func:`~logging.config.dictConfig` *可以* 对日志过滤器进行设置,尽管乍一看做法并不明显(所以才需要本秘籍)。 "
1372+
"由于 :class:`~logging.Filter` 是标准库中唯一的日志过滤器类,不太可能满足众多的要求(它只是作为基类存在),通常需要定义自己的 "
1373+
":class:`~logging.Filter` 子类,并重写 :meth:`~logging.Filter.filter` "
1374+
"方法。为此,请在过滤器的配置字典中设置 ``()`` "
1375+
"键,指定要用于创建过滤器的可调用对象(最明显可用的就是给出一个类,但也可以提供任何一个可调用对象,只要能返回 "
1376+
":class:`~logging.Filter` 实例即可)。下面是一个完整的例子:"
13401377

13411378
#: ../../howto/logging-cookbook.rst:2136
13421379
msgid ""
13431380
"This example shows how you can pass configuration data to the callable which"
13441381
" constructs the instance, in the form of keyword parameters. When run, the "
13451382
"above script will print:"
1346-
msgstr ""
1383+
msgstr "以上示例展示了将配置数据传给构造实例的可调用对象,形式是关键字参数。运行后将会输出:"
13471384

13481385
#: ../../howto/logging-cookbook.rst:2144
13491386
msgid "which shows that the filter is working as configured."
1350-
msgstr ""
1387+
msgstr "这说明过滤器按照配置的参数生效了。"
13511388

13521389
#: ../../howto/logging-cookbook.rst:2146
13531390
msgid "A couple of extra points to note:"
@@ -1362,6 +1399,9 @@ msgid ""
13621399
"have used the text ``'ext://__main__.MyFilter'`` instead of ``MyFilter`` in "
13631400
"the above example."
13641401
msgstr ""
1402+
"如果在配置中无法直接引用可调用对象(比如位于不同的模块中,并且不能在配置字典所在的位置直接导入),则可以采用 ``ext://...`` 的形式,正如 "
1403+
":ref:`logging-config-dict-externalobj` 所述。例如,在上述示例中可以使用文本 "
1404+
"``'ext://__main__.MyFilter'`` 而不是 ``MyFilter`` 对象。 "
13651405

13661406
#: ../../howto/logging-cookbook.rst:2155
13671407
msgid ""

library/subprocess.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ msgid ""
1717
msgstr ""
1818
"Project-Id-Version: Python 3.9\n"
1919
"Report-Msgid-Bugs-To: \n"
20-
"POT-Creation-Date: 2021-07-23 06:59+0000\n"
20+
"POT-Creation-Date: 2021-07-25 07:01+0000\n"
2121
"PO-Revision-Date: 2017-02-16 23:28+0000\n"
2222
"Last-Translator: Freesand Leo <[email protected]>, 2021\n"
2323
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
@@ -995,15 +995,15 @@ msgstr "在子进程中抛出的异常,在新的进程开始执行前,将会
995995
msgid ""
996996
"The most common exception raised is :exc:`OSError`. This occurs, for "
997997
"example, when trying to execute a non-existent file. Applications should "
998-
"prepare for :exc:`OSError` exceptions. Note that, when ``\"shell=True\"``, "
998+
"prepare for :exc:`OSError` exceptions. Note that, when ``shell=True``, "
999999
":exc:`OSError` will be raised by the child only if the selected shell itself"
10001000
" was not found. To determine if the shell failed to find the requested "
10011001
"application, it is necessary to check the return code or output from the "
10021002
"subprocess."
10031003
msgstr ""
10041004
"被引发的最一般异常是 :exc:`OSError`。 例如这会在尝试执行一个不存在的文件时发生。 应用程序应当为 :exc:`OSError` "
1005-
"异常做好准备。 请注意,如果 ``\"shell=True\"``,则 :exc:`OSError` 仅会在未找到选定的 shell 本身时被引发。 "
1006-
"要确定 shell 是否未找到所请求的应用程序,必须检查来自子进程的返回码或输出。"
1005+
"异常做好准备。 请注意,如果 ``shell=True``,则 :exc:`OSError` 仅会在未找到选定的 shell 本身时被引发。 要确定 "
1006+
"shell 是否未找到所请求的应用程序,必须检查来自子进程的返回码或输出。"
10071007

10081008
#: ../../library/subprocess.rst:670
10091009
msgid ""

0 commit comments

Comments
 (0)