diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-06-07 18:52:37 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-06-07 18:52:37 +0000 |
| commit | 817f5f3196441540ef5b6d092984240d554dd20b (patch) | |
| tree | f1efdd3c5411b5d7b920f22e8a3a60360fdf7640 /openstackclient/common/parseractions.py | |
| parent | 7dc2e1dc08b0692a3accb343c62451fb3d83f4cd (diff) | |
| parent | b36d521ff6d4f7a994d4472c25f8267b6e268d41 (diff) | |
| download | python-openstackclient-817f5f3196441540ef5b6d092984240d554dd20b.tar.gz | |
Merge "Fix i18n supports in commom"
Diffstat (limited to 'openstackclient/common/parseractions.py')
| -rw-r--r-- | openstackclient/common/parseractions.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/openstackclient/common/parseractions.py b/openstackclient/common/parseractions.py index 77798f90..c535b4f3 100644 --- a/openstackclient/common/parseractions.py +++ b/openstackclient/common/parseractions.py @@ -87,8 +87,8 @@ class MultiKeyValueAction(argparse.Action): if '=' in kv: params.update([kv.split('=', 1)]) else: - msg = ("Expected key=value pairs separated by comma, " - "but got: %s" % (str(kv))) + msg = _("Expected key=value pairs separated by comma, " + "but got: %s") % (str(kv)) raise argparse.ArgumentTypeError(msg) # Check key validation @@ -139,12 +139,13 @@ class RangeAction(argparse.Action): if int(range[0]) <= int(range[1]): setattr(namespace, self.dest, (int(range[0]), int(range[1]))) else: - msg = "Invalid range, %s is not less than %s" % \ - (range[0], range[1]) + msg = (_("Invalid range, %(range0)s is not " + "less than %(range1)s") + % {'range0': range[0], 'range1': range[1]}) raise argparse.ArgumentError(self, msg) else: # Too many values - msg = "Invalid range, too many values" + msg = _("Invalid range, too many values") raise argparse.ArgumentError(self, msg) @@ -158,5 +159,6 @@ class NonNegativeAction(argparse.Action): if int(values) >= 0: setattr(namespace, self.dest, values) else: - msg = "%s expected a non-negative integer" % (str(option_string)) + msg = (_("%s expected a non-negative integer") + % (str(option_string))) raise argparse.ArgumentTypeError(msg) |
