@@ -2531,6 +2531,11 @@ msgid ""
25312531"implementation of :meth:`tzinfo.fromutc` to work correctly with "
25322532":meth:`~.datetime.astimezone` regardless."
25332533msgstr ""
2534+ "必须为具有同样的 :class:`tzinfo` 子类的每个 :class:`.datetime` *dt* 且 ``dt.tzinfo == tz``"
2535+ " 返回同样的结果,此表达式会产生时区的“标准时差”,它不应依赖于具体日期或时间,而只依赖于地理位置。 "
2536+ ":meth:`datetime.astimezone` 的实现依赖此方法,但无法检测违反规则的情况;确保符合规则是程序员的责任。 如果一个 "
2537+ ":class:`tzinfo` 子类不能保证这一点,也许可以重写 :meth:`tzinfo.fromutc` 的默认实现以便在任何情况下与 "
2538+ ":meth:`~.datetime.astimezone` 正确配合。"
25342539
25352540#: ../../library/datetime.rst:2059
25362541msgid ""
@@ -2559,6 +2564,11 @@ msgid ""
25592564"return different names depending on the specific value of *dt* passed, "
25602565"especially if the :class:`tzinfo` class is accounting for daylight time."
25612566msgstr ""
2567+ "将对应于 :class:`.datetime` 对象 *dt* 的时区名称作为字符串返回。 :mod:`!datetime` "
2568+ "模块没有定义任何有关字符串名称的内容。 例如,\" GMT\" , \" UTC\" , \" -500\" , \" -5:00\" , \" EDT\" , "
2569+ "\" US/Eastern\" , \" America/New York\" 都是有效的返回值。 如果字符串名称未知则返回 ``None``。 "
2570+ "请注意这是一个方法而不是一个固定的字符串,这主要是因为某些 :class:`tzinfo` 子类可能需要根据所传入的特定 *dt* "
2571+ "值返回不同的名称,特别是在 :class:`tzinfo` 要负责处理夏令时的场合。"
25622572
25632573#: ../../library/datetime.rst:2095
25642574msgid ""
@@ -2637,6 +2647,11 @@ msgid ""
26372647" you want if the result is one of the hours straddling the moment the "
26382648"standard offset changes."
26392649msgstr ""
2650+ "大多数 :class:`tzinfo` 子类应该能够毫无问题地继承默认的 :meth:`fromutc` 实现。 "
2651+ "它的健壮性足以处理固定差值的时区以及同时负责标准时和夏令时的时区,对于后者甚至还能处理 DST 转换时间在各个年份有变化的情况。 一个默认 "
2652+ ":meth:`fromutc` 实现可能无法在所有情况下正确处理的例子是(与 UTC "
2653+ "的)标准时差取决于所经过的特定日期和时间,这种情况可能由于政治原因而出现。 默认的 :meth:`~.datetime.astimezone` 和 "
2654+ ":meth:`fromutc` 实现可能无法生成你希望的结果,如果这个结果恰好是跨越了标准时差发生改变的时刻当中的某个小时值的话。"
26402655
26412656#: ../../library/datetime.rst:2138
26422657msgid ""
@@ -2692,12 +2707,20 @@ msgid ""
26922707"attribute set to 0 and the later times have it set to 1. For example, at the"
26932708" Fall back transition of 2016, we get::"
26942709msgstr ""
2710+ "当 DST 结束时(见 \" end\" 行),会有更糟糕的潜在问题:本地时间值中有一个小时是不可能没有歧义的:夏令时的最后一小时。 "
2711+ "即以北美东部时间表示当天夏令时结束时的形式为 5:MM UTC 的时间。 本地时钟从 1:59(夏令时)再次跳回到 1:00(标准时)。 形式为 "
2712+ "1:MM 的本地时间就是有歧义的。 此时 :meth:`~.datetime.astimezone` 是通过将两个相邻的 UTC "
2713+ "小时映射到两个相同的本地小时来模仿本地时钟的行为。 在这个北美东部时间的示例中,形式为 5:MM 和 6:MM 的 UTC "
2714+ "时间在转换为北美东部时间时都将被映射到 1:MM,但前一个时间会将 :attr:`~.datetime.fold` 属性设为 0 而后一个时间会将其设为"
2715+ " 1。 例如,在 2016 年秋季时钟往回调整时,我们得到::"
26952716
26962717#: ../../library/datetime.rst:2217
26972718msgid ""
26982719"Note that the :class:`.datetime` instances that differ only by the value of "
26992720"the :attr:`~.datetime.fold` attribute are considered equal in comparisons."
27002721msgstr ""
2722+ "请注意不同的 :class:`.datetime` 实例仅通过 :attr:`~.datetime.fold` "
2723+ "属性值来加以区分,它们在比较时会被视为相等。"
27012724
27022725#: ../../library/datetime.rst:2220
27032726msgid ""
@@ -2708,6 +2731,9 @@ msgid ""
27082731"as a class representing only EST (fixed offset -5 hours), or only EDT (fixed"
27092732" offset -4 hours))."
27102733msgstr ""
2734+ "不允许时间显示存在歧义的应用程序需要显式地检查 :attr:`~.datetime.fold` 属性的值,或者避免使用混合式的 "
2735+ ":class:`tzinfo` 子类;当使用 :class:`timezone` 或者任何其他固定差值的 :class:`tzinfo` "
2736+ "子类(例如仅表示 EST (固定差值 -5 小时),或仅表示 EDT (固定差值 -4 小时) 的类时是不会有歧义的)。"
27112737
27122738#: ../../library/datetime.rst:2234
27132739msgid ":mod:`zoneinfo`"
@@ -2929,7 +2955,7 @@ msgstr "以下列表显示了 1989 版 C 标准所要求的全部格式代码,
29292955
29302956#: ../../library/datetime.rst:2366 ../../library/datetime.rst:2469
29312957msgid "Directive"
2932- msgstr "指令 "
2958+ msgstr "指示符 "
29332959
29342960#: ../../library/datetime.rst:2366 ../../library/datetime.rst:2469
29352961msgid "Meaning"
@@ -3295,7 +3321,7 @@ msgstr "%"
32953321msgid ""
32963322"Several additional directives not required by the C89 standard are included "
32973323"for convenience. These parameters all correspond to ISO 8601 date values."
3298- msgstr "为了方便起见,还包括了C89标准不需要的其他一些指令。这些参数都对应于ISO 8601日期值 。"
3324+ msgstr "为了方便起见,还包括了C89标准不需要的其他一些指示符。 这些参数都对应于 ISO 8601 日期值 。"
32993325
33003326#: ../../library/datetime.rst:2471
33013327msgid "``%G``"
@@ -3364,8 +3390,8 @@ msgid ""
33643390"8601 directives will raise a :exc:`ValueError`."
33653391msgstr ""
33663392"这些代码可能不是在所有平台上都可与 :meth:`~.datetime.strftime` 方法配合使用。 ISO 8601 年份和 ISO 8601 "
3367- "星期指令并不能与上面的年份和星期序号指令相互替代 。 调用 :meth:`~.datetime.strptime` 时传入不完整或有歧义的 ISO "
3368- "8601 指令将引发 :exc:`ValueError`。"
3393+ "星期指示符并不能与上面的年份和星期序号指示符相互替代 。 调用 :meth:`~.datetime.strptime` 时传入不完整或有歧义的 ISO "
3394+ "8601 指示符将引发 :exc:`ValueError`。"
33693395
33703396#: ../../library/datetime.rst:2496
33713397msgid ""
@@ -3490,8 +3516,8 @@ msgid ""
34903516"only affects the output hour field if the ``%I`` directive is used to parse "
34913517"the hour."
34923518msgstr ""
3493- "当与 :meth:`~.datetime.strptime` 方法一起使用时,如果使用 ``%I`` 指令来解析时 ,则 ``%p`` "
3494- "指令只会影响输出时字段 。"
3519+ "当与 :meth:`~.datetime.strptime` 方法一起使用时,如果使用 ``%I`` 指示符来解析时 ,则 ``%p`` "
3520+ "指示符只会影响输出时字段 。"
34953521
34963522#: ../../library/datetime.rst:2566
34973523msgid ""
@@ -3506,6 +3532,8 @@ msgid ""
35063532"extension to the set of format characters in the C standard (but implemented"
35073533" separately in datetime objects, and therefore always available)."
35083534msgstr ""
3535+ "当与 :meth:`~.datetime.strptime` 方法一起使用时,``%f`` 指示符可接受一至六个数码及左边的零填充。 ``%f`` 是对"
3536+ " C 标准中格式字符集的扩展(但单独在 datetime 对象中实现,因此它总是可用)。"
35093537
35103538#: ../../library/datetime.rst:2577
35113539msgid ""
@@ -3530,6 +3558,12 @@ msgid ""
35303558":meth:`~.datetime.utcoffset` returns ``timedelta(hours=-3, minutes=-30)``, "
35313559"``%z`` is replaced with the string ``'-0330'``."
35323560msgstr ""
3561+ ":meth:`~.datetime.utcoffset` 会被转换为 ``±HHMM[SS[.ffffff]]`` 形式的字符串,其中 ``HH`` "
3562+ "为给出 UTC 时差的小时部分的 2 位数码字符串,``MM`` 为给出 UTC 时差的分钟部分的 2 位数码字符串,``SS`` 为给出 UTC "
3563+ "时差的秒部分的 2 位数码字符串,而 ``ffffff`` 则为给出 UTC 时差的微秒部分的 6 位数码字符串。 当时差为整数秒时 "
3564+ "``ffffff`` 部分将被省略,而当时差为整数分钟时 ``ffffff`` 和 ``SS`` 部分都将被省略。 举例来说,如果 "
3565+ ":meth:`~.datetime.utcoffset` 返回 ``timedelta(hours=-3, minutes=-30)``,则 "
3566+ "``%z`` 会被替换为字符串 ``'-0330'``。"
35333567
35343568#: ../../library/datetime.rst:2597
35353569msgid ""
@@ -3539,6 +3573,8 @@ msgid ""
35393573"offset of one hour. In addition, providing ``'Z'`` is identical to "
35403574"``'+00:00'``."
35413575msgstr ""
3576+ "当向 :meth:`~.datetime.strptime` 方法提供 ``%z`` 指示符时,UTC 差值可以在时、分和秒之间使用冒号作为分隔符。 "
3577+ "例如,``'+01:00:00'`` 将被解读为一小时的差值。 此外,提供 ``'Z'`` 就相当于 ``'+00:00'``。"
35423578
35433579#: ../../library/datetime.rst:2605
35443580msgid ""
@@ -3582,7 +3618,7 @@ msgid ""
35823618"method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` "
35833619"of the result will be set to a :class:`timezone` instance."
35843620msgstr ""
3585- "当提供 ``%z`` 指令给 :meth:`~.datetime.strptime` 方法时,将产生一个感知型 :class:`.datetime` "
3621+ "当提供 ``%z`` 指示符给 :meth:`~.datetime.strptime` 方法时,将产生一个感知型 :class:`.datetime` "
35863622"对象。 结果的 ``tzinfo`` 将被设为一个 :class:`timezone` 实例。"
35873623
35883624#: ../../library/datetime.rst:2628
0 commit comments