From bb71df9ced18f343911fb90e745b4d875672cf27 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Fri, 3 Oct 2014 22:54:42 -0400 Subject: [PATCH] Mark identity v2 resources for translation mark v2 catalog, ec2, endpoint, project, role, service and token Change-Id: I14a5852bfee4ca9e25130d001fdadd7778ad0996 --- openstackclient/identity/v2_0/catalog.py | 3 +- openstackclient/identity/v2_0/ec2creds.py | 15 +++++----- openstackclient/identity/v2_0/endpoint.py | 17 +++++------ openstackclient/identity/v2_0/project.py | 35 ++++++++++++----------- openstackclient/identity/v2_0/role.py | 31 +++++++++----------- openstackclient/identity/v2_0/service.py | 19 ++++++------ openstackclient/identity/v2_0/token.py | 4 ++- 7 files changed, 64 insertions(+), 60 deletions(-) diff --git a/openstackclient/identity/v2_0/catalog.py b/openstackclient/identity/v2_0/catalog.py index 7bda1acb68..1a96fdf60f 100644 --- a/openstackclient/identity/v2_0/catalog.py +++ b/openstackclient/identity/v2_0/catalog.py @@ -20,6 +20,7 @@ from cliff import lister from cliff import show from openstackclient.common import utils +from openstackclient.i18n import _ # noqa def _format_endpoints(eps=None): @@ -67,7 +68,7 @@ class ShowCatalog(show.ShowOne): parser.add_argument( 'service', metavar='', - help='Service to display (type, name or ID)', + help=_('Service to display (type, name or ID)'), ) return parser diff --git a/openstackclient/identity/v2_0/ec2creds.py b/openstackclient/identity/v2_0/ec2creds.py index 74c9d5ebab..fd8eef8463 100644 --- a/openstackclient/identity/v2_0/ec2creds.py +++ b/openstackclient/identity/v2_0/ec2creds.py @@ -24,6 +24,7 @@ from cliff import lister from cliff import show from openstackclient.common import utils +from openstackclient.i18n import _ # noqa class CreateEC2Creds(show.ShowOne): @@ -36,12 +37,12 @@ class CreateEC2Creds(show.ShowOne): parser.add_argument( '--project', metavar='', - help='Specify a project [admin only]', + help=_('Specify a project [admin only]'), ) parser.add_argument( '--user', metavar='', - help='Specify a user [admin only]', + help=_('Specify a user [admin only]'), ) return parser @@ -83,12 +84,12 @@ class DeleteEC2Creds(command.Command): parser.add_argument( 'access_key', metavar='', - help='Credentials access key', + help=_('Credentials access key'), ) parser.add_argument( '--user', metavar='', - help='Specify a user [admin only]', + help=_('Specify a user [admin only]'), ) return parser @@ -118,7 +119,7 @@ class ListEC2Creds(lister.Lister): parser.add_argument( '--user', metavar='', - help='Specify a user [admin only]', + help=_('Specify a user [admin only]'), ) return parser @@ -156,12 +157,12 @@ class ShowEC2Creds(show.ShowOne): parser.add_argument( 'access_key', metavar='', - help='Credentials access key', + help=_('Credentials access key'), ) parser.add_argument( '--user', metavar='', - help='Specify a user [admin only]', + help=_('Specify a user [admin only]'), ) return parser diff --git a/openstackclient/identity/v2_0/endpoint.py b/openstackclient/identity/v2_0/endpoint.py index 36f52cad4d..f7d7883109 100644 --- a/openstackclient/identity/v2_0/endpoint.py +++ b/openstackclient/identity/v2_0/endpoint.py @@ -23,6 +23,7 @@ from cliff import lister from cliff import show from openstackclient.common import utils +from openstackclient.i18n import _ # noqa from openstackclient.identity import common @@ -36,24 +37,24 @@ class CreateEndpoint(show.ShowOne): parser.add_argument( 'service', metavar='', - help='New endpoint service') + help=_('New endpoint service')) parser.add_argument( '--region', metavar='', - help='New endpoint region') + help=_('New endpoint region')) parser.add_argument( '--publicurl', metavar='', required=True, - help='New endpoint public URL') + help=_('New endpoint public URL')) parser.add_argument( '--adminurl', metavar='', - help='New endpoint admin URL') + help=_('New endpoint admin URL')) parser.add_argument( '--internalurl', metavar='', - help='New endpoint internal URL') + help=_('New endpoint internal URL')) return parser def take_action(self, parsed_args): @@ -84,7 +85,7 @@ class DeleteEndpoint(command.Command): parser.add_argument( 'endpoint', metavar='', - help='ID of endpoint to delete') + help=_('ID of endpoint to delete')) return parser def take_action(self, parsed_args): @@ -105,7 +106,7 @@ class ListEndpoint(lister.Lister): '--long', action='store_true', default=False, - help='List additional fields in output') + help=_('List additional fields in output')) return parser def take_action(self, parsed_args): @@ -139,7 +140,7 @@ class ShowEndpoint(show.ShowOne): parser.add_argument( 'endpoint_or_service', metavar='', - help='Endpoint ID or name, type or ID of service to display') + help=_('Endpoint ID or name, type or ID of service to display')) return parser def take_action(self, parsed_args): diff --git a/openstackclient/identity/v2_0/project.py b/openstackclient/identity/v2_0/project.py index ebd65df7d6..7ead0890d4 100644 --- a/openstackclient/identity/v2_0/project.py +++ b/openstackclient/identity/v2_0/project.py @@ -21,10 +21,11 @@ import six from cliff import command from cliff import lister from cliff import show - from keystoneclient.openstack.common.apiclient import exceptions as ksc_exc + from openstackclient.common import parseractions from openstackclient.common import utils +from openstackclient.i18n import _ # noqa class CreateProject(show.ShowOne): @@ -37,30 +38,30 @@ class CreateProject(show.ShowOne): parser.add_argument( 'name', metavar='', - help='New project name', + help=_('New project name'), ) parser.add_argument( '--description', metavar='', - help='New project description', + help=_('New project description'), ) enable_group = parser.add_mutually_exclusive_group() enable_group.add_argument( '--enable', action='store_true', - help='Enable project (default)', + help=_('Enable project (default)'), ) enable_group.add_argument( '--disable', action='store_true', - help='Disable project', + help=_('Disable project'), ) parser.add_argument( '--property', metavar='', action=parseractions.KeyValueAction, - help='Property to add for this project ' - '(repeat option to set multiple properties)', + help=_('Property to add for this project ' + '(repeat option to set multiple properties)'), ) return parser @@ -97,7 +98,7 @@ class DeleteProject(command.Command): parser.add_argument( 'project', metavar='', - help='Project to delete (name or ID)', + help=_('Project to delete (name or ID)'), ) return parser @@ -125,7 +126,7 @@ class ListProject(lister.Lister): '--long', action='store_true', default=False, - help='List additional fields in output', + help=_('List additional fields in output'), ) return parser @@ -153,35 +154,35 @@ class SetProject(command.Command): parser.add_argument( 'project', metavar='', - help='Project to change (name or ID)', + help=_('Project to change (name or ID)'), ) parser.add_argument( '--name', metavar='', - help='New project name', + help=_('New project name'), ) parser.add_argument( '--description', metavar='', - help='New project description', + help=_('New project description'), ) enable_group = parser.add_mutually_exclusive_group() enable_group.add_argument( '--enable', action='store_true', - help='Enable project', + help=_('Enable project'), ) enable_group.add_argument( '--disable', action='store_true', - help='Disable project', + help=_('Disable project'), ) parser.add_argument( '--property', metavar='', action=parseractions.KeyValueAction, - help='Property to add for this project ' - '(repeat option to set multiple properties)', + help=_('Property to add for this project ' + '(repeat option to set multiple properties)'), ) return parser @@ -233,7 +234,7 @@ class ShowProject(show.ShowOne): parser.add_argument( 'project', metavar='', - help='Project to display (name or ID)') + help=_('Project to display (name or ID)')) return parser def take_action(self, parsed_args): diff --git a/openstackclient/identity/v2_0/role.py b/openstackclient/identity/v2_0/role.py index faf48ed95f..4c45004dae 100644 --- a/openstackclient/identity/v2_0/role.py +++ b/openstackclient/identity/v2_0/role.py @@ -24,6 +24,7 @@ from cliff import show from openstackclient.common import exceptions from openstackclient.common import utils +from openstackclient.i18n import _ # noqa class AddRole(show.ShowOne): @@ -36,18 +37,17 @@ class AddRole(show.ShowOne): parser.add_argument( 'role', metavar='', - help='Role name or ID to add to user') + help=_('Role name or ID to add to user')) parser.add_argument( '--project', metavar='', required=True, - help='Include project (name or ID)', - ) + help=_('Include project (name or ID)')) parser.add_argument( '--user', metavar='', required=True, - help='Name or ID of user to include') + help=_('Name or ID of user to include')) return parser def take_action(self, parsed_args): @@ -80,7 +80,7 @@ class CreateRole(show.ShowOne): parser.add_argument( 'role_name', metavar='', - help='New role name') + help=_('New role name')) return parser def take_action(self, parsed_args): @@ -103,8 +103,7 @@ class DeleteRole(command.Command): parser.add_argument( 'role', metavar='', - help='Name or ID of role to delete', - ) + help=_('Name or ID of role to delete')) return parser def take_action(self, parsed_args): @@ -147,12 +146,11 @@ class ListUserRole(lister.Lister): 'user', metavar='', nargs='?', - help='Name or ID of user to include') + help=_('Name or ID of user to include')) parser.add_argument( '--project', metavar='', - help='Include project (name or ID)', - ) + help=_('Include project (name or ID)')) return parser def take_action(self, parsed_args): @@ -167,13 +165,13 @@ class ListUserRole(lister.Lister): if self.app.client_manager.auth_ref: parsed_args.project = auth_ref.project_id else: - msg = "Project must be specified" + msg = _("Project must be specified") raise exceptions.CommandError(msg) if not parsed_args.user: if self.app.client_manager.auth_ref: parsed_args.user = auth_ref.user_id else: - msg = "User must be specified" + msg = _("User must be specified") raise exceptions.CommandError(msg) project = utils.find_resource( @@ -213,18 +211,17 @@ class RemoveRole(command.Command): parser.add_argument( 'role', metavar='', - help='Role name or ID to remove from user') + help=_('Role name or ID to remove from user')) parser.add_argument( '--project', metavar='', required=True, - help='Project to include (name or ID)', - ) + help=_('Project to include (name or ID)')) parser.add_argument( '--user', metavar='', required=True, - help='Name or ID of user') + help=_('Name or ID of user')) return parser def take_action(self, parsed_args): @@ -252,7 +249,7 @@ class ShowRole(show.ShowOne): parser.add_argument( 'role', metavar='', - help='Name or ID of role to display') + help=_('Name or ID of role to display')) return parser def take_action(self, parsed_args): diff --git a/openstackclient/identity/v2_0/service.py b/openstackclient/identity/v2_0/service.py index 138ed3b097..458dce7cba 100644 --- a/openstackclient/identity/v2_0/service.py +++ b/openstackclient/identity/v2_0/service.py @@ -24,6 +24,7 @@ from cliff import show from openstackclient.common import exceptions from openstackclient.common import utils +from openstackclient.i18n import _ # noqa from openstackclient.identity import common @@ -37,18 +38,18 @@ class CreateService(show.ShowOne): parser.add_argument( 'name', metavar='', - help='New service name', + help=_('New service name'), ) parser.add_argument( '--type', metavar='', required=True, - help='New service type (compute, image, identity, volume, etc)', + help=_('New service type (compute, image, identity, volume, etc)'), ) parser.add_argument( '--description', metavar='', - help='New service description', + help=_('New service description'), ) return parser @@ -76,7 +77,7 @@ class DeleteService(command.Command): parser.add_argument( 'service', metavar='', - help='Service to delete (name or ID)', + help=_('Service to delete (name or ID)'), ) return parser @@ -99,7 +100,7 @@ class ListService(lister.Lister): '--long', action='store_true', default=False, - help='List additional fields in output') + help=_('List additional fields in output')) return parser def take_action(self, parsed_args): @@ -127,13 +128,13 @@ class ShowService(show.ShowOne): parser.add_argument( 'service', metavar='', - help='Service to display (type, name or ID)', + help=_('Service to display (type, name or ID)'), ) parser.add_argument( '--catalog', action='store_true', default=False, - help='Show service catalog information', + help=_('Show service catalog information'), ) return parser @@ -150,8 +151,8 @@ class ShowService(show.ShowOne): info.update(service_endpoints[0]) return zip(*sorted(six.iteritems(info))) - msg = ("No service catalog with a type, name or ID of '%s' " - "exists." % (parsed_args.service)) + msg = _("No service catalog with a type, name or ID of '%s' " + "exists.") % (parsed_args.service) raise exceptions.CommandError(msg) else: service = common.find_service(identity_client, parsed_args.service) diff --git a/openstackclient/identity/v2_0/token.py b/openstackclient/identity/v2_0/token.py index f3fedc0107..c8b003ee02 100644 --- a/openstackclient/identity/v2_0/token.py +++ b/openstackclient/identity/v2_0/token.py @@ -21,6 +21,8 @@ import six from cliff import command from cliff import show +from openstackclient.i18n import _ # noqa + class IssueToken(show.ShowOne): """Issue new token""" @@ -49,7 +51,7 @@ class RevokeToken(command.Command): parser.add_argument( 'token', metavar='', - help='Token to be deleted', + help=_('Token to be deleted'), ) return parser