diff options
author | Tetiana Lashchova <tlashchova@mirantis.com> | 2014-12-01 17:54:08 +0200 |
---|---|---|
committer | Tetiana Lashchova <tlashchova@mirantis.com> | 2014-12-10 12:25:06 +0200 |
commit | 6ff27ccabf0580d57f48e607b21535f5475ff3fe (patch) | |
tree | 032bf46d2426b7e134da7745c7d27a566b5b787f /heatclient/common/utils.py | |
parent | 4916c64f7fc126cbcce05055569d4ff7efb37e3a (diff) | |
download | python-heatclient-6ff27ccabf0580d57f48e607b21535f5475ff3fe.tar.gz |
Add transtlation markers for error messages
Change-Id: Ic44073880b7e65b6530a7314a5a2d65eb4aadb09
Partial-Bug: #1269930
Diffstat (limited to 'heatclient/common/utils.py')
-rw-r--r-- | heatclient/common/utils.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/heatclient/common/utils.py b/heatclient/common/utils.py index efa3593..22a9059 100644 --- a/heatclient/common/utils.py +++ b/heatclient/common/utils.py @@ -25,6 +25,7 @@ from oslo.serialization import jsonutils from oslo.utils import importutils from heatclient import exc +from heatclient.openstack.common._i18n import _ from heatclient.openstack.common import cliutils supported_formats = { @@ -93,8 +94,12 @@ def find_resource(manager, name_or_id): try: return manager.find(name=name_or_id) except exc.NotFound: - msg = "No %s with a name or ID of '%s' exists." % \ - (manager.resource_class.__name__.lower(), name_or_id) + msg = _("No %(name)s with a name or ID of " + "'%(name_or_id)s' exists.") % \ + { + 'name': manager.resource_class.__name__.lower(), + 'name_or_id': name_or_id + } raise exc.CommandError(msg) @@ -127,8 +132,7 @@ def format_parameters(params): try: (n, v) = p.split(('='), 1) except ValueError: - msg = '%s(%s). %s.' % ('Malformed parameter', p, - 'Use the key=value format') + msg = _('Malformed parameter(%s). Use the key=value format.') % p raise exc.CommandError(msg) if n not in parameters: @@ -147,7 +151,7 @@ def format_output(output, format='yaml'): try: return supported_formats[output_format](output) except KeyError: - raise exc.HTTPUnsupported("The format(%s) is unsupported." + raise exc.HTTPUnsupported(_("The format(%s) is unsupported.") % output_format) |