diff options
| author | Éric Araujo <merwok@netwok.org> | 2010-12-04 17:31:49 +0000 |
|---|---|---|
| committer | Éric Araujo <merwok@netwok.org> | 2010-12-04 17:31:49 +0000 |
| commit | 89a2c0126f92cd87fbb70d8ec7a6e0ed21d969eb (patch) | |
| tree | d5786b5dc65463d388155239c5afc8f4688941fd /Lib/argparse.py | |
| parent | 0c9ffbd3962691222d01633e4a4a71b3103dcbb3 (diff) | |
| download | cpython-89a2c0126f92cd87fbb70d8ec7a6e0ed21d969eb.tar.gz | |
Use proper plural forms in argparse (#4391)
Diffstat (limited to 'Lib/argparse.py')
| -rw-r--r-- | Lib/argparse.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index 747586d5bd..557cc00fa7 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -88,7 +88,7 @@ import re as _re import sys as _sys import textwrap as _textwrap -from gettext import gettext as _ +from gettext import gettext as _, ngettext def _callable(obj): @@ -1438,7 +1438,9 @@ class _ActionsContainer(object): conflict_handler(action, confl_optionals) def _handle_conflict_error(self, action, conflicting_actions): - message = _('conflicting option string(s): %s') + message = ngettext('conflicting option string: %s', + 'conflicting option strings: %s', + len(conflicting_actions)) conflict_string = ', '.join([option_string for option_string, action in conflicting_actions]) @@ -1995,7 +1997,9 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): OPTIONAL: _('expected at most one argument'), ONE_OR_MORE: _('expected at least one argument'), } - default = _('expected %s argument(s)') % action.nargs + default = ngettext('expected %s argument', + 'expected %s arguments', + action.nargs) % action.nargs msg = nargs_errors.get(action.nargs, default) raise ArgumentError(action, msg) |
