Re-enable lazy translation
This patch re-enables lazy translation to enable REST API responses to be translated to the requested locale (I.E. setting 'Accept-Language: zh-CN'.) This patch also removes the unnecessary manual import of 'cinder.openstack.common.gettextutils _' in Cinder code. Since _ is still being imported in the cinder.openstack.common files from Oslo we still need to set gettexttutils.enable_lazy(). enable_lazy will be able to be removed once the manual imports of _ have been removed from Oslo. implements-bp: i18n-messages Change-Id: I0b5a35a2cc28d97d12ceccccd58565b487fef428
This commit is contained in:
parent
9550b6b6b4
commit
6338d4656c
@ -42,7 +42,8 @@ if os.path.exists(os.path.join(possible_topdir, "cinder", "__init__.py")):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder', lazy=False)
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
# Need to register global_opts
|
||||
from cinder.common import config # noqa
|
||||
|
@ -32,7 +32,8 @@ if os.path.exists(os.path.join(possible_topdir, "cinder", "__init__.py")):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder', lazy=False)
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
# Need to register global_opts
|
||||
from cinder.common import config # noqa
|
||||
|
@ -36,7 +36,8 @@ if os.path.exists(os.path.join(possible_topdir, 'cinder', '__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder')
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
# Need to register global_opts
|
||||
from cinder.common import config # noqa
|
||||
|
@ -35,7 +35,8 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'cinder', '__init__.py')):
|
||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder')
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
# Need to register global_opts
|
||||
from cinder.common import config # noqa
|
||||
|
@ -70,7 +70,8 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'cinder', '__init__.py')):
|
||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder')
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
# Need to register global_opts
|
||||
from cinder.common import config # noqa
|
||||
|
@ -16,13 +16,14 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import gettext
|
||||
import gettextutils
|
||||
import re
|
||||
import sys
|
||||
|
||||
import rtslib
|
||||
|
||||
gettext.install('cinder-rtstool', unicode=1)
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder-rtstool', lazy=True)
|
||||
|
||||
|
||||
class RtstoolError(Exception):
|
||||
|
@ -36,7 +36,8 @@ if os.path.exists(os.path.join(possible_topdir, 'cinder', '__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder')
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
# Need to register global_opts
|
||||
from cinder.common import config # noqa
|
||||
|
@ -40,7 +40,8 @@ if os.path.exists(os.path.join(possible_topdir, 'cinder', '__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder')
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
# Need to register global_opts
|
||||
from cinder.common import config # noqa
|
||||
|
@ -50,7 +50,8 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'cinder', '__init__.py')):
|
||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder')
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
|
@ -21,7 +21,6 @@ from cinder.api import xmlutil
|
||||
from cinder import db
|
||||
from cinder.db.sqlalchemy import api as sqlalchemy_api
|
||||
from cinder import exception
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder import quota
|
||||
|
||||
|
@ -30,7 +30,6 @@ import webob.exc
|
||||
from cinder.api.openstack import wsgi
|
||||
from cinder.api.views import limits as limits_views
|
||||
from cinder.api import xmlutil
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import jsonutils
|
||||
from cinder import quota
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
"""Exceptions for the Brick library."""
|
||||
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import log as logging
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@ from cinder.brick.initiator import host_driver
|
||||
from cinder.brick.initiator import linuxfc
|
||||
from cinder.brick.initiator import linuxscsi
|
||||
from cinder.brick.remotefs import remotefs
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import lockutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import loopingcall
|
||||
|
@ -17,7 +17,6 @@
|
||||
import errno
|
||||
|
||||
from cinder.brick.initiator import linuxscsi
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils as putils
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
import os
|
||||
|
||||
from cinder.brick import executor
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils as putils
|
||||
|
||||
|
@ -24,7 +24,6 @@ import itertools
|
||||
|
||||
from cinder.brick import exception
|
||||
from cinder.brick import executor
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils as putils
|
||||
|
||||
|
@ -21,7 +21,6 @@ import re
|
||||
import six
|
||||
|
||||
from cinder.brick import exception
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils as putils
|
||||
|
||||
|
@ -29,8 +29,6 @@ import socket
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
@ -18,7 +18,8 @@ import os
|
||||
from oslo.config import cfg
|
||||
|
||||
from cinder.openstack.common import gettextutils
|
||||
gettextutils.install('cinder', lazy=False)
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('cinder', lazy=True)
|
||||
|
||||
from cinder.db.sqlalchemy import migrate_repo
|
||||
from cinder import version
|
||||
|
@ -27,7 +27,6 @@ import sys
|
||||
from oslo.config import cfg
|
||||
import webob.exc
|
||||
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import log as logging
|
||||
|
||||
|
||||
|
@ -38,7 +38,6 @@ from oslo.config import cfg
|
||||
from cinder import exception
|
||||
from cinder.keymgr import key
|
||||
from cinder.keymgr import key_mgr
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import log as logging
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
from oslo.config import cfg
|
||||
|
||||
from cinder import exception
|
||||
from cinder.openstack.common.gettextutils import _
|
||||
from cinder.openstack.common import policy
|
||||
from cinder import utils
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user