From 9991b26db1f094286f0d9ad8dbf1f6fb9f13c03a Mon Sep 17 00:00:00 2001 From: Ghe Rivero Date: Tue, 10 Mar 2015 00:31:46 +0100 Subject: [PATCH] Use oslo.i18n lib Stop using gettextutils from oslo.incubator and replace with the graduated library oslo.i18n Change-Id: I479be348f6e0894ecff5cd93d37ee66648f3ea01 --- ironicclient/client.py | 4 +--- ironicclient/common/i18n.py | 31 +++++++++++++++++++++++++++++++ ironicclient/common/utils.py | 1 + ironicclient/shell.py | 4 +--- ironicclient/v1/driver.py | 1 + ironicclient/v1/node.py | 1 + ironicclient/v1/node_shell.py | 1 + openstack-common.conf | 2 -- 8 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 ironicclient/common/i18n.py diff --git a/ironicclient/client.py b/ironicclient/client.py index 1dda6036e..6075ca9a2 100644 --- a/ironicclient/client.py +++ b/ironicclient/client.py @@ -14,11 +14,9 @@ from keystoneclient.v2_0 import client as ksclient +from ironicclient.common.i18n import _ from ironicclient.common import utils from ironicclient import exc -from ironicclient.openstack.common import gettextutils - -gettextutils.install('ironicclient') def _get_ksclient(**kwargs): diff --git a/ironicclient/common/i18n.py b/ironicclient/common/i18n.py new file mode 100644 index 000000000..35d33b4df --- /dev/null +++ b/ironicclient/common/i18n.py @@ -0,0 +1,31 @@ +# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. +# All Rights Reserved. +# +# 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. + +import oslo_i18n + +_translators = oslo_i18n.TranslatorFactory(domain='ironicclient') + +# 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/ironicclient/common/utils.py b/ironicclient/common/utils.py index 4961b336a..d3e03390c 100644 --- a/ironicclient/common/utils.py +++ b/ironicclient/common/utils.py @@ -20,6 +20,7 @@ from __future__ import print_function import argparse import json +from ironicclient.common.i18n import _ from ironicclient import exc from ironicclient.openstack.common import importutils diff --git a/ironicclient/shell.py b/ironicclient/shell.py index 7df7c23cd..9ff59a922 100644 --- a/ironicclient/shell.py +++ b/ironicclient/shell.py @@ -34,12 +34,10 @@ import six.moves.urllib.parse as urlparse import ironicclient from ironicclient import client as iroclient +from ironicclient.common.i18n import _ from ironicclient.common import utils from ironicclient import exc from ironicclient.openstack.common import cliutils -from ironicclient.openstack.common import gettextutils - -gettextutils.install('ironicclient') LATEST_API_VERSION = ('1', 'latest') diff --git a/ironicclient/v1/driver.py b/ironicclient/v1/driver.py index fc3df0c7b..761c5fd2a 100644 --- a/ironicclient/v1/driver.py +++ b/ironicclient/v1/driver.py @@ -16,6 +16,7 @@ # under the License. from ironicclient.common import base +from ironicclient.common.i18n import _ from ironicclient import exc diff --git a/ironicclient/v1/node.py b/ironicclient/v1/node.py index 4ba8041c4..e20cc2cd6 100644 --- a/ironicclient/v1/node.py +++ b/ironicclient/v1/node.py @@ -17,6 +17,7 @@ import os from ironicclient.common import base +from ironicclient.common.i18n import _ from ironicclient.common import utils from ironicclient import exc diff --git a/ironicclient/v1/node_shell.py b/ironicclient/v1/node_shell.py index 0b6e981aa..1742c41ee 100644 --- a/ironicclient/v1/node_shell.py +++ b/ironicclient/v1/node_shell.py @@ -19,6 +19,7 @@ import argparse import six +from ironicclient.common.i18n import _ from ironicclient.common import utils from ironicclient.openstack.common.apiclient import exceptions from ironicclient.openstack.common import cliutils diff --git a/openstack-common.conf b/openstack-common.conf index a970f3bdc..fad8f0fe6 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -1,10 +1,8 @@ [DEFAULT] # The list of modules to copy from openstack-common -module=_i18n module=apiclient module=cliutils -module=gettextutils module=importutils module=strutils # The base module to hold the copy of openstack.common