@@ -579,28 +579,33 @@ msgid ""
579
579
"actions, ``store_true`` and ``store_false``. For example, you might have a "
580
580
"``verbose`` flag that is turned on with ``-v`` and off with ``-q``::"
581
581
msgstr ""
582
+ "旗标选项 --- 当看到特定选项时将某个变量设为真值或假值 --- 是相当常见的。 :mod:`optparse` "
583
+ "通过两个单独的动作支持它们,``store_true`` 和 ``store_false``。 例如,你可能会有个 ``verbose`` 旗标将通过 "
584
+ "``-v`` 来启用并通过 ``-q`` 来禁用::"
582
585
583
586
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:390
584
587
msgid ""
585
588
"Here we have two different options with the same destination, which is "
586
589
"perfectly OK. (It just means you have to be a bit careful when setting "
587
590
"default values---see below.)"
588
- msgstr ""
591
+ msgstr "这里我们有两个相同目标的不同选项,这是完全可行的。 (只是这意味着在设置默认值时你必须更加小心 --- 见下文所述。) "
589
592
590
593
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:394
591
594
msgid ""
592
595
"When :mod:`optparse` encounters ``-v`` on the command line, it sets "
593
596
"``options.verbose`` to ``True``; when it encounters ``-q``, "
594
597
"``options.verbose`` is set to ``False``."
595
598
msgstr ""
599
+ "当 :mod:`optparse` 在命令行中遇到 ``-v`` 时,它会将 ``options.verbose`` 设为 ``True``;当它遇到 "
600
+ "``-q`` 时,则会将 ``options.verbose`` 设为 ``False``。"
596
601
597
602
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:402
598
603
msgid "Other actions"
599
- msgstr ""
604
+ msgstr "其他动作 "
600
605
601
606
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:404
602
607
msgid "Some other actions supported by :mod:`optparse` are:"
603
- msgstr ""
608
+ msgstr "受到 :mod:`optparse` 支持的其他动作还有: "
604
609
605
610
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:407
606
611
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:928
@@ -620,7 +625,7 @@ msgstr "``\"append\"``"
620
625
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:410
621
626
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:937
622
627
msgid "append this option's argument to a list"
623
- msgstr ""
628
+ msgstr "将此选项的参数添加到一个列表 "
624
629
625
630
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:413
626
631
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:943
@@ -630,7 +635,7 @@ msgstr "``\"count\"``"
630
635
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:413
631
636
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:943
632
637
msgid "increment a counter by one"
633
- msgstr ""
638
+ msgstr "让指定的计数器加一 "
634
639
635
640
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:416
636
641
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:946
@@ -661,19 +666,24 @@ msgid ""
661
666
"control. :mod:`optparse` lets you supply a default value for each "
662
667
"destination, which is assigned before the command line is parsed."
663
668
msgstr ""
669
+ "上述示例全都涉及当看到特定命令行选项时设置某些变量(即“目标”)的操作。 "
670
+ "如果从未看到这些选项那么会发生什么叱?由于我们没有提供任何默认值,它们全都会被设为 ``None``。 这通常是可以的,但有时你会想要更多的控制。 "
671
+ ":mod:`optparse` 允许你为每个目标提供默认值,它们将在解析命令行之前被赋值。"
664
672
665
673
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:434
666
674
msgid ""
667
675
"First, consider the verbose/quiet example. If we want :mod:`optparse` to "
668
676
"set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::"
669
677
msgstr ""
678
+ "首先,考虑这个 verbose/quiet 示例。 如果我们希望 :mod:`optparse` 将 ``verbose`` 设为 ``True`` "
679
+ "除非看到了 ``-q``,那么我们可以这样做::"
670
680
671
681
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:440
672
682
msgid ""
673
683
"Since default values apply to the *destination* rather than to any "
674
684
"particular option, and these two options happen to have the same "
675
685
"destination, this is exactly equivalent::"
676
- msgstr ""
686
+ msgstr "由于默认值将应用到 *destination* 而不是任何特定选项,并且这两个选项正好具有相同的目标,因此这是完全等价的:: "
677
687
678
688
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:447
679
689
msgid "Consider this::"
@@ -683,25 +693,27 @@ msgstr "考虑一下:"
683
693
msgid ""
684
694
"Again, the default value for ``verbose`` will be ``True``: the last default "
685
695
"value supplied for any particular destination is the one that counts."
686
- msgstr ""
696
+ msgstr "同样地,``verbose`` 的默认值将为 ``True``: 最终生效的将是最后提供给任何特定目标的默认值。 "
687
697
688
698
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:455
689
699
msgid ""
690
700
"A clearer way to specify default values is the :meth:`set_defaults` method "
691
701
"of OptionParser, which you can call at any time before calling "
692
702
":meth:`parse_args`::"
693
703
msgstr ""
704
+ "一种更清晰的默认值指定方式是使用 OptionParser 的 :meth:`set_defaults` 方法,你可以在调用 "
705
+ ":meth:`parse_args` 之前的任何时候调用它::"
694
706
695
707
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:462
696
708
msgid ""
697
709
"As before, the last value specified for a given option destination is the "
698
710
"one that counts. For clarity, try to use one method or the other of setting"
699
711
" default values, not both."
700
- msgstr ""
712
+ msgstr "如前面一样,最终生效的将是最后为特定选项目标指定的值。 为清楚起见,请使用一种或另外一种设置默认值的方法,而不要同时使用。 "
701
713
702
714
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:470
703
715
msgid "Generating help"
704
- msgstr ""
716
+ msgstr "生成帮助 "
705
717
706
718
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:472
707
719
msgid ""
@@ -711,6 +723,9 @@ msgid ""
711
723
"short usage message for your whole program. Here's an OptionParser "
712
724
"populated with user-friendly (documented) options::"
713
725
msgstr ""
726
+ ":mod:`optparse` 自动生成帮助和用法文本的功能适用于创建用户友好的命令行界面。 你所要做的只是为每个选项提供 "
727
+ ":attr:`~Option.help` 值,并可选项为你的整个程序提供一条简短的用法消息。 下面是一个填充了用户友好的(文档)选项的 "
728
+ "OptionParser::"
714
729
715
730
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:493
716
731
msgid ""
0 commit comments