diff --git a/novaclient/client.py b/novaclient/client.py index 5cd2d8f02..4a7189386 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -44,7 +44,7 @@ except ImportError: from six.moves.urllib import parse from novaclient import exceptions -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import service_catalog from novaclient import utils diff --git a/novaclient/i18n.py b/novaclient/i18n.py new file mode 100644 index 000000000..e9d39d4ab --- /dev/null +++ b/novaclient/i18n.py @@ -0,0 +1,35 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""oslo.i18n integration module for novaclient. + +See http://docs.openstack.org/developer/oslo.i18n/usage.html . + +""" + +from oslo import i18n + + +_translators = i18n.TranslatorFactory(domain='novaclient') + +# The primary translation function using the well-known name "_" +_ = _translators.primary + +# Translators for log levels. +# +# The abbreviated names are meant to reflect the usual use of a short +# name like '_'. The "L" is for "log" and the other letter comes from +# the level. +_LI = _translators.log_info +_LW = _translators.log_warning +_LE = _translators.log_error +_LC = _translators.log_critical diff --git a/novaclient/shell.py b/novaclient/shell.py index 405ca7051..fff534179 100644 --- a/novaclient/shell.py +++ b/novaclient/shell.py @@ -47,8 +47,8 @@ import novaclient.auth_plugin from novaclient import client from novaclient import exceptions as exc import novaclient.extension +from novaclient.i18n import _ from novaclient.openstack.common import cliutils -from novaclient.openstack.common.gettextutils import _ from novaclient import utils from novaclient.v1_1 import shell as shell_v1_1 from novaclient.v3 import shell as shell_v3 diff --git a/novaclient/utils.py b/novaclient/utils.py index 2fee83d6c..cf1bc7b21 100644 --- a/novaclient/utils.py +++ b/novaclient/utils.py @@ -23,8 +23,8 @@ import prettytable import six from novaclient import exceptions +from novaclient.i18n import _ from novaclient.openstack.common import cliutils -from novaclient.openstack.common.gettextutils import _ arg = cliutils.arg diff --git a/novaclient/v1_1/contrib/baremetal.py b/novaclient/v1_1/contrib/baremetal.py index 82803184a..02e7ad76b 100644 --- a/novaclient/v1_1/contrib/baremetal.py +++ b/novaclient/v1_1/contrib/baremetal.py @@ -16,8 +16,9 @@ """ Baremetal interface (v2 extension). """ + from novaclient import base -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/contrib/cells.py b/novaclient/v1_1/contrib/cells.py index 7c59400ef..f3b544ed7 100644 --- a/novaclient/v1_1/contrib/cells.py +++ b/novaclient/v1_1/contrib/cells.py @@ -14,7 +14,7 @@ # under the License. from novaclient import base -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/contrib/host_evacuate.py b/novaclient/v1_1/contrib/host_evacuate.py index 12ad602fa..fc9416afc 100644 --- a/novaclient/v1_1/contrib/host_evacuate.py +++ b/novaclient/v1_1/contrib/host_evacuate.py @@ -14,7 +14,7 @@ # under the License. from novaclient import base -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/contrib/host_evacuate_live.py b/novaclient/v1_1/contrib/host_evacuate_live.py index 6ac4a018f..0f6a59673 100644 --- a/novaclient/v1_1/contrib/host_evacuate_live.py +++ b/novaclient/v1_1/contrib/host_evacuate_live.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/contrib/host_servers_migrate.py b/novaclient/v1_1/contrib/host_servers_migrate.py index ac5238f42..95268186b 100644 --- a/novaclient/v1_1/contrib/host_servers_migrate.py +++ b/novaclient/v1_1/contrib/host_servers_migrate.py @@ -14,7 +14,7 @@ # under the License. from novaclient import base -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/contrib/instance_action.py b/novaclient/v1_1/contrib/instance_action.py index cddc30012..1e4ed5829 100644 --- a/novaclient/v1_1/contrib/instance_action.py +++ b/novaclient/v1_1/contrib/instance_action.py @@ -16,7 +16,7 @@ import pprint from novaclient import base -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/contrib/metadata_extensions.py b/novaclient/v1_1/contrib/metadata_extensions.py index 27b864f7a..54bf8fd04 100644 --- a/novaclient/v1_1/contrib/metadata_extensions.py +++ b/novaclient/v1_1/contrib/metadata_extensions.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils from novaclient.v1_1 import shell diff --git a/novaclient/v1_1/contrib/migrations.py b/novaclient/v1_1/contrib/migrations.py index 16be844ab..d43cb7a15 100644 --- a/novaclient/v1_1/contrib/migrations.py +++ b/novaclient/v1_1/contrib/migrations.py @@ -17,7 +17,7 @@ migration interface from six.moves.urllib import parse from novaclient import base -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/contrib/tenant_networks.py b/novaclient/v1_1/contrib/tenant_networks.py index 8c9b22ebc..288d06cb4 100644 --- a/novaclient/v1_1/contrib/tenant_networks.py +++ b/novaclient/v1_1/contrib/tenant_networks.py @@ -13,7 +13,7 @@ # limitations under the License. from novaclient import base -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/flavor_access.py b/novaclient/v1_1/flavor_access.py index 3b4ce43e6..fdc43cd7a 100644 --- a/novaclient/v1_1/flavor_access.py +++ b/novaclient/v1_1/flavor_access.py @@ -16,7 +16,7 @@ """Flavor access interface.""" from novaclient import base -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ class FlavorAccess(base.Resource): diff --git a/novaclient/v1_1/flavors.py b/novaclient/v1_1/flavors.py index 018bc1cf0..86781847f 100644 --- a/novaclient/v1_1/flavors.py +++ b/novaclient/v1_1/flavors.py @@ -21,7 +21,7 @@ from six.moves.urllib import parse from novaclient import base from novaclient import exceptions -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient import utils diff --git a/novaclient/v1_1/networks.py b/novaclient/v1_1/networks.py index a27502868..06dee2704 100644 --- a/novaclient/v1_1/networks.py +++ b/novaclient/v1_1/networks.py @@ -19,7 +19,7 @@ Network interface. from novaclient import base from novaclient import exceptions -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ class Network(base.Resource): diff --git a/novaclient/v1_1/security_group_default_rules.py b/novaclient/v1_1/security_group_default_rules.py index 5208cb061..ec9f63aa4 100644 --- a/novaclient/v1_1/security_group_default_rules.py +++ b/novaclient/v1_1/security_group_default_rules.py @@ -16,7 +16,7 @@ Security group default rules interface. from novaclient import base from novaclient import exceptions -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ class SecurityGroupDefaultRule(base.Resource): diff --git a/novaclient/v1_1/security_group_rules.py b/novaclient/v1_1/security_group_rules.py index f1348920a..1f12a4c1c 100644 --- a/novaclient/v1_1/security_group_rules.py +++ b/novaclient/v1_1/security_group_rules.py @@ -19,7 +19,7 @@ Security group rules interface (1.1 extension). from novaclient import base from novaclient import exceptions -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ class SecurityGroupRule(base.Resource): diff --git a/novaclient/v1_1/servers.py b/novaclient/v1_1/servers.py index 9851012f7..29a4baf30 100644 --- a/novaclient/v1_1/servers.py +++ b/novaclient/v1_1/servers.py @@ -27,7 +27,7 @@ from six.moves.urllib import parse from novaclient import base from novaclient import crypto -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ from novaclient.v1_1 import security_groups diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py index eb5b39a12..1530bd8f9 100644 --- a/novaclient/v1_1/shell.py +++ b/novaclient/v1_1/shell.py @@ -34,8 +34,8 @@ from oslo.utils import timeutils import six from novaclient import exceptions +from novaclient.i18n import _ from novaclient.openstack.common import cliutils -from novaclient.openstack.common.gettextutils import _ from novaclient.openstack.common import uuidutils from novaclient import utils from novaclient.v1_1 import availability_zones diff --git a/novaclient/v3/servers.py b/novaclient/v3/servers.py index c9324c477..ce2c82058 100644 --- a/novaclient/v3/servers.py +++ b/novaclient/v3/servers.py @@ -27,7 +27,8 @@ from six.moves.urllib import parse from novaclient import base from novaclient import crypto -from novaclient.openstack.common.gettextutils import _ +from novaclient.i18n import _ + REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD' diff --git a/novaclient/v3/shell.py b/novaclient/v3/shell.py index 957491543..315303b1d 100644 --- a/novaclient/v3/shell.py +++ b/novaclient/v3/shell.py @@ -32,8 +32,8 @@ from oslo.utils import timeutils import six from novaclient import exceptions +from novaclient.i18n import _ from novaclient.openstack.common import cliutils -from novaclient.openstack.common.gettextutils import _ from novaclient.openstack.common import uuidutils from novaclient import utils from novaclient.v3 import availability_zones diff --git a/openstack-common.conf b/openstack-common.conf index 3af93417e..d303f591a 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -3,7 +3,6 @@ # The list of modules to copy from oslo-incubator module=apiclient module=cliutils -module=gettextutils module=install_venv_common module=uuidutils diff --git a/requirements.txt b/requirements.txt index 2a1c48ae4..5b897b0fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ pbr>=0.6,!=0.7,<1.0 argparse iso8601>=0.1.9 +oslo.i18n>=1.0.0 # Apache-2.0 oslo.serialization>=1.0.0 # Apache-2.0 oslo.utils>=1.0.0 # Apache-2.0 PrettyTable>=0.7,<0.8 diff --git a/tox.ini b/tox.ini index b38ae1c4a..28c6542cf 100644 --- a/tox.ini +++ b/tox.ini @@ -48,4 +48,4 @@ show-source = True exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build,doc/source/conf.py [hacking] -import_exceptions = novaclient.openstack.common.gettextutils +import_exceptions = novaclient.i18n