diff --git a/MANIFEST.in b/MANIFEST.in index fd87b80fdf..aeabc0d31a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,10 +1,12 @@ include AUTHORS +include babel.cfg include ChangeLog include LICENSE include README.rst recursive-include doc * recursive-include tests * +recursive-include python-openstackclient *.po *.pot exclude .gitignore exclude .gitreview diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000000..efceab818b --- /dev/null +++ b/babel.cfg @@ -0,0 +1 @@ +[python: **.py] diff --git a/openstackclient/i18n.py b/openstackclient/i18n.py index bd52d64838..3611b315c9 100644 --- a/openstackclient/i18n.py +++ b/openstackclient/i18n.py @@ -15,7 +15,7 @@ from oslo import i18n -_translators = i18n.TranslatorFactory(domain='openstackclient') +_translators = i18n.TranslatorFactory(domain='python-openstackclient') # The primary translation function using the well-known name "_" _ = _translators.primary diff --git a/openstackclient/identity/v2_0/user.py b/openstackclient/identity/v2_0/user.py index 93ab94fe0e..729c6ac81f 100644 --- a/openstackclient/identity/v2_0/user.py +++ b/openstackclient/identity/v2_0/user.py @@ -21,9 +21,10 @@ 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 utils +from openstackclient.i18n import _ # noqa class CreateUser(show.ShowOne): @@ -36,39 +37,39 @@ class CreateUser(show.ShowOne): parser.add_argument( 'name', metavar='', - help='New user name', + help=_('New user name'), ) parser.add_argument( '--password', metavar='', - help='New user password', + help=_('New user password'), ) parser.add_argument( '--password-prompt', dest="password_prompt", action="store_true", - help='Prompt interactively for password', + help=_('Prompt interactively for password'), ) parser.add_argument( '--email', metavar='', - help='New user email address', + help=_('New user email address'), ) parser.add_argument( '--project', metavar='', - help='Set default project (name or ID)', + help=_('Set default project (name or ID)'), ) enable_group = parser.add_mutually_exclusive_group() enable_group.add_argument( '--enable', action='store_true', - help='Enable user (default)', + help=_('Enable user (default)'), ) enable_group.add_argument( '--disable', action='store_true', - help='Disable user', + help=_('Disable user'), ) return parser @@ -120,7 +121,7 @@ class DeleteUser(command.Command): parser.add_argument( 'user', metavar='', - help='User to delete (name or ID)', + help=_('User to delete (name or ID)'), ) return parser @@ -147,13 +148,13 @@ class ListUser(lister.Lister): parser.add_argument( '--project', metavar='', - help='Filter users by project (name or ID)', + help=_('Filter users by project (name or ID)'), ) parser.add_argument( '--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): @@ -237,44 +238,44 @@ class SetUser(command.Command): parser.add_argument( 'user', metavar='', - help='User to change (name or ID)', + help=_('User to change (name or ID)'), ) parser.add_argument( '--name', metavar='', - help='New user name', + help=_('New user name'), ) parser.add_argument( '--password', metavar='', - help='New user password', + help=_('New user password'), ) parser.add_argument( '--password-prompt', dest="password_prompt", action="store_true", - help='Prompt interactively for password', + help=_('Prompt interactively for password'), ) parser.add_argument( '--email', metavar='', - help='New user email address', + help=_('New user email address'), ) parser.add_argument( '--project', metavar='', - help='New default project (name or ID)', + help=_('New default project (name or ID)'), ) enable_group = parser.add_mutually_exclusive_group() enable_group.add_argument( '--enable', action='store_true', - help='Enable user (default)', + help=_('Enable user (default)'), ) enable_group.add_argument( '--disable', action='store_true', - help='Disable user', + help=_('Disable user'), ) return parser @@ -340,7 +341,7 @@ class ShowUser(show.ShowOne): parser.add_argument( 'user', metavar='', - help='User to display (name or ID)', + help=_('User to display (name or ID)'), ) return parser diff --git a/python-openstackclient/locale/python-openstackclient.pot b/python-openstackclient/locale/python-openstackclient.pot new file mode 100644 index 0000000000..5dcdac88b9 --- /dev/null +++ b/python-openstackclient/locale/python-openstackclient.pot @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 "" + diff --git a/requirements.txt b/requirements.txt index 04f448834f..f6d1c61c08 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ # 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 # process, which may cause wedges in the gate later. +Babel>=1.3 cliff>=1.7.0 # Apache-2.0 oslo.i18n>=1.0.0 # Apache-2.0 oslo.utils>=1.0.0 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg index 3178fe4467..e97bbd2a6c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -320,3 +320,17 @@ upload-dir = doc/build/html [wheel] 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 diff --git a/test-requirements.txt b/test-requirements.txt index 3b95cf7db3..50ddc88e9c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -13,5 +13,3 @@ sphinx>=1.1.2,!=1.2.0,<1.3 testrepository>=0.0.18 testtools>=0.9.34 WebOb>=1.2.3 - -Babel>=1.3