oslo.i18n migration
Switch ironic to use oslo.i18n. A new i18n module has been added under ironic with translation globals and imports the necessary functions from oslo.i18n. gettextutils module is still needed in the nova ironic driver. Change-Id: I682228e158132c628166e4d1e334c4003249d112
This commit is contained in:
parent
c87cbe62ec
commit
61533bbe24
@ -18,9 +18,10 @@ Use this file for deploying the API service under Apache2 mod_wsgi.
|
|||||||
|
|
||||||
from ironic.api import app
|
from ironic.api import app
|
||||||
from ironic.common import service
|
from ironic.common import service
|
||||||
from ironic.openstack.common import gettextutils
|
|
||||||
|
|
||||||
gettextutils.install('ironic')
|
from oslo import i18n
|
||||||
|
|
||||||
|
i18n.install('ironic')
|
||||||
|
|
||||||
service.prepare_service([])
|
service.prepare_service([])
|
||||||
|
|
||||||
|
@ -13,5 +13,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ironic.openstack.common import gettextutils
|
from oslo import i18n
|
||||||
gettextutils.install('ironic')
|
|
||||||
|
i18n.install('ironic')
|
||||||
|
@ -25,7 +25,7 @@ SHOULD include dedicated exception logging.
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ironic.openstack.common.gettextutils import _
|
from ironic.common.i18n import _
|
||||||
from ironic.openstack.common import log as logging
|
from ironic.openstack.common import log as logging
|
||||||
|
|
||||||
|
|
||||||
|
31
ironic/common/i18n.py
Normal file
31
ironic/common/i18n.py
Normal file
@ -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.
|
||||||
|
|
||||||
|
from oslo import i18n # noqa
|
||||||
|
|
||||||
|
_translators = i18n.TranslatorFactory(domain='ironic')
|
||||||
|
|
||||||
|
# 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
|
@ -20,8 +20,8 @@ import os.path
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ironic.common import exception
|
from ironic.common import exception
|
||||||
|
from ironic.common.i18n import _
|
||||||
from ironic.common import utils
|
from ironic.common import utils
|
||||||
from ironic.openstack.common.gettextutils import _
|
|
||||||
from ironic.openstack.common import policy
|
from ironic.openstack.common import policy
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ pysendfile==2.0.0
|
|||||||
websockify>=0.5.1,<0.6
|
websockify>=0.5.1,<0.6
|
||||||
oslo.config>=1.2.1
|
oslo.config>=1.2.1
|
||||||
oslo.rootwrap
|
oslo.rootwrap
|
||||||
|
oslo.i18n>=0.1.0 # Apache-2.0
|
||||||
pecan>=0.4.5
|
pecan>=0.4.5
|
||||||
six>=1.7.0
|
six>=1.7.0
|
||||||
jsonpatch>=1.1
|
jsonpatch>=1.1
|
||||||
|
2
tox.ini
2
tox.ini
@ -48,4 +48,4 @@ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,t
|
|||||||
[hacking]
|
[hacking]
|
||||||
import_exceptions = ironic.openstack.common.gettextutils._, ironic.openstack.common.gettextutils._LI,
|
import_exceptions = ironic.openstack.common.gettextutils._, ironic.openstack.common.gettextutils._LI,
|
||||||
ironic.openstack.common.gettextutils._LW,ironic.openstack.common.gettextutils._LE,
|
ironic.openstack.common.gettextutils._LW,ironic.openstack.common.gettextutils._LE,
|
||||||
ironic.openstack.common.gettextutils._LC, testtools.matchers
|
ironic.openstack.common.gettextutils._LC, testtools.matchers, ironic.common.i18n._
|
||||||
|
Loading…
x
Reference in New Issue
Block a user