From b36d521ff6d4f7a994d4472c25f8267b6e268d41 Mon Sep 17 00:00:00 2001 From: Huanxuan Ao Date: Tue, 7 Jun 2016 19:16:24 +0800 Subject: Fix i18n supports in commom I checked all the files in openstackclient/common and fixed the missing i18n supprots. Change-Id: Id7f76a24aae663f5832ef9bcf1bd5a6b7081af24 Partial-bug: #1574965 --- openstackclient/common/parseractions.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'openstackclient/common/parseractions.py') 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) -- cgit v1.2.1