Trivial: Fix i18n support in network/common.py
Some missing i18n problems in network. Change-Id: I45a09a6ada1aad5a64256c0d0a0a2b6e250df670
This commit is contained in:
parent
ca58ab9d09
commit
5a3a7867a8
@ -17,6 +17,7 @@ from openstack import connection
|
||||
from openstack import profile
|
||||
|
||||
from openstackclient.common import utils
|
||||
from openstackclient.i18n import _
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -51,7 +52,7 @@ def build_option_parser(parser):
|
||||
'--os-network-api-version',
|
||||
metavar='<network-api-version>',
|
||||
default=utils.env('OS_NETWORK_API_VERSION'),
|
||||
help='Network API version, default=' +
|
||||
DEFAULT_API_VERSION +
|
||||
' (Env: OS_NETWORK_API_VERSION)')
|
||||
help=_("Network API version, default=%s "
|
||||
"(Env: OS_NETWORK_API_VERSION)") % DEFAULT_API_VERSION
|
||||
)
|
||||
return parser
|
||||
|
@ -16,6 +16,7 @@ import six
|
||||
|
||||
from openstackclient.common import command
|
||||
from openstackclient.common import exceptions
|
||||
from openstackclient.i18n import _
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
@ -94,14 +95,22 @@ class NetworkAndComputeDelete(NetworkAndComputeCommand):
|
||||
self.take_action_compute(self.app.client_manager.compute,
|
||||
parsed_args)
|
||||
except Exception as e:
|
||||
self.app.log.error("Failed to delete %s with name or ID "
|
||||
"'%s': %s" % (self.resource, r, e))
|
||||
msg = _("Failed to delete %(resource)s with name or ID "
|
||||
"'%(name_or_id)s': %(e)s") % {
|
||||
"resource": self.resource,
|
||||
"name_or_id": r,
|
||||
"e": e,
|
||||
}
|
||||
self.app.log.error(msg)
|
||||
ret += 1
|
||||
|
||||
if ret:
|
||||
total = len(resources)
|
||||
msg = "%s of %s %ss failed to delete." % (ret, total,
|
||||
self.resource)
|
||||
msg = _("%(num)s of %(total)s %(resource)s failed to delete.") % {
|
||||
"num": ret,
|
||||
"total": total,
|
||||
"resource": self.resource,
|
||||
}
|
||||
raise exceptions.CommandError(msg)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user