Add translation markers for user v2 actions

implements bp use_i18n

Change-Id: I86508a232c9cf88695b7982dad0b9b02eaf8b3a1
This commit is contained in:
Steve Martinelli 2014-10-03 22:29:47 -04:00
parent 5c8b43e891
commit b61db3eb72
8 changed files with 118 additions and 23 deletions

View File

@ -1,10 +1,12 @@
include AUTHORS include AUTHORS
include babel.cfg
include ChangeLog include ChangeLog
include LICENSE include LICENSE
include README.rst include README.rst
recursive-include doc * recursive-include doc *
recursive-include tests * recursive-include tests *
recursive-include python-openstackclient *.po *.pot
exclude .gitignore exclude .gitignore
exclude .gitreview exclude .gitreview

1
babel.cfg Normal file
View File

@ -0,0 +1 @@
[python: **.py]

View File

@ -15,7 +15,7 @@
from oslo import i18n from oslo import i18n
_translators = i18n.TranslatorFactory(domain='openstackclient') _translators = i18n.TranslatorFactory(domain='python-openstackclient')
# The primary translation function using the well-known name "_" # The primary translation function using the well-known name "_"
_ = _translators.primary _ = _translators.primary

View File

@ -21,9 +21,10 @@ import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
from cliff import show from cliff import show
from keystoneclient.openstack.common.apiclient import exceptions as ksc_exc from keystoneclient.openstack.common.apiclient import exceptions as ksc_exc
from openstackclient.common import utils from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
class CreateUser(show.ShowOne): class CreateUser(show.ShowOne):
@ -36,39 +37,39 @@ class CreateUser(show.ShowOne):
parser.add_argument( parser.add_argument(
'name', 'name',
metavar='<user-name>', metavar='<user-name>',
help='New user name', help=_('New user name'),
) )
parser.add_argument( parser.add_argument(
'--password', '--password',
metavar='<user-password>', metavar='<user-password>',
help='New user password', help=_('New user password'),
) )
parser.add_argument( parser.add_argument(
'--password-prompt', '--password-prompt',
dest="password_prompt", dest="password_prompt",
action="store_true", action="store_true",
help='Prompt interactively for password', help=_('Prompt interactively for password'),
) )
parser.add_argument( parser.add_argument(
'--email', '--email',
metavar='<user-email>', metavar='<user-email>',
help='New user email address', help=_('New user email address'),
) )
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help='Set default project (name or ID)', help=_('Set default project (name or ID)'),
) )
enable_group = parser.add_mutually_exclusive_group() enable_group = parser.add_mutually_exclusive_group()
enable_group.add_argument( enable_group.add_argument(
'--enable', '--enable',
action='store_true', action='store_true',
help='Enable user (default)', help=_('Enable user (default)'),
) )
enable_group.add_argument( enable_group.add_argument(
'--disable', '--disable',
action='store_true', action='store_true',
help='Disable user', help=_('Disable user'),
) )
return parser return parser
@ -120,7 +121,7 @@ class DeleteUser(command.Command):
parser.add_argument( parser.add_argument(
'user', 'user',
metavar='<user>', metavar='<user>',
help='User to delete (name or ID)', help=_('User to delete (name or ID)'),
) )
return parser return parser
@ -147,13 +148,13 @@ class ListUser(lister.Lister):
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help='Filter users by project (name or ID)', help=_('Filter users by project (name or ID)'),
) )
parser.add_argument( parser.add_argument(
'--long', '--long',
action='store_true', action='store_true',
default=False, default=False,
help='List additional fields in output') help=_('List additional fields in output'))
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
@ -237,44 +238,44 @@ class SetUser(command.Command):
parser.add_argument( parser.add_argument(
'user', 'user',
metavar='<user>', metavar='<user>',
help='User to change (name or ID)', help=_('User to change (name or ID)'),
) )
parser.add_argument( parser.add_argument(
'--name', '--name',
metavar='<new-user-name>', metavar='<new-user-name>',
help='New user name', help=_('New user name'),
) )
parser.add_argument( parser.add_argument(
'--password', '--password',
metavar='<user-password>', metavar='<user-password>',
help='New user password', help=_('New user password'),
) )
parser.add_argument( parser.add_argument(
'--password-prompt', '--password-prompt',
dest="password_prompt", dest="password_prompt",
action="store_true", action="store_true",
help='Prompt interactively for password', help=_('Prompt interactively for password'),
) )
parser.add_argument( parser.add_argument(
'--email', '--email',
metavar='<user-email>', metavar='<user-email>',
help='New user email address', help=_('New user email address'),
) )
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help='New default project (name or ID)', help=_('New default project (name or ID)'),
) )
enable_group = parser.add_mutually_exclusive_group() enable_group = parser.add_mutually_exclusive_group()
enable_group.add_argument( enable_group.add_argument(
'--enable', '--enable',
action='store_true', action='store_true',
help='Enable user (default)', help=_('Enable user (default)'),
) )
enable_group.add_argument( enable_group.add_argument(
'--disable', '--disable',
action='store_true', action='store_true',
help='Disable user', help=_('Disable user'),
) )
return parser return parser
@ -340,7 +341,7 @@ class ShowUser(show.ShowOne):
parser.add_argument( parser.add_argument(
'user', 'user',
metavar='<user>', metavar='<user>',
help='User to display (name or ID)', help=_('User to display (name or ID)'),
) )
return parser return parser

View File

@ -0,0 +1,78 @@
# Translations template for python-openstackclient.
# Copyright (C) 2014 ORGANIZATION
# This file is distributed under the same license as the
# python-openstackclient project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: python-openstackclient 0.4.2.dev43.gaf67658\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2014-10-09 13:11-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: openstackclient/identity/v2_0/user.py:40
#: openstackclient/identity/v2_0/user.py:246
msgid "New user name"
msgstr ""
#: openstackclient/identity/v2_0/user.py:45
#: openstackclient/identity/v2_0/user.py:251
msgid "New user password"
msgstr ""
#: openstackclient/identity/v2_0/user.py:51
#: openstackclient/identity/v2_0/user.py:257
msgid "Prompt interactively for password"
msgstr ""
#: openstackclient/identity/v2_0/user.py:56
#: openstackclient/identity/v2_0/user.py:262
msgid "New user email address"
msgstr ""
#: openstackclient/identity/v2_0/user.py:61
msgid "Set default project (name or ID)"
msgstr ""
#: openstackclient/identity/v2_0/user.py:67
#: openstackclient/identity/v2_0/user.py:273
msgid "Enable user (default)"
msgstr ""
#: openstackclient/identity/v2_0/user.py:72
#: openstackclient/identity/v2_0/user.py:278
msgid "Disable user"
msgstr ""
#: openstackclient/identity/v2_0/user.py:124
msgid "User to delete (name or ID)"
msgstr ""
#: openstackclient/identity/v2_0/user.py:151
msgid "Filter users by project (name or ID)"
msgstr ""
#: openstackclient/identity/v2_0/user.py:157
msgid "List additional fields in output"
msgstr ""
#: openstackclient/identity/v2_0/user.py:241
msgid "User to change (name or ID)"
msgstr ""
#: openstackclient/identity/v2_0/user.py:267
msgid "New default project (name or ID)"
msgstr ""
#: openstackclient/identity/v2_0/user.py:344
msgid "User to display (name or ID)"
msgstr ""

View File

@ -1,6 +1,7 @@
# The order of packages is significant, because pip processes them in the order # The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
Babel>=1.3
cliff>=1.7.0 # Apache-2.0 cliff>=1.7.0 # Apache-2.0
oslo.i18n>=1.0.0 # Apache-2.0 oslo.i18n>=1.0.0 # Apache-2.0
oslo.utils>=1.0.0 # Apache-2.0 oslo.utils>=1.0.0 # Apache-2.0

View File

@ -320,3 +320,17 @@ upload-dir = doc/build/html
[wheel] [wheel]
universal = 1 universal = 1
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = python-openstackclient/locale/python-openstackclient.pot
[update_catalog]
domain = python-openstackclient
output_dir = python-openstackclient/locale
input_file = python-openstackclient/locale/python-openstackclient.pot
[compile_catalog]
directory = python-openstackclient/locale
domain = python-openstackclient

View File

@ -13,5 +13,3 @@ sphinx>=1.1.2,!=1.2.0,<1.3
testrepository>=0.0.18 testrepository>=0.0.18
testtools>=0.9.34 testtools>=0.9.34
WebOb>=1.2.3 WebOb>=1.2.3
Babel>=1.3