Enable lazy translation for Cinder

This patch is the final step for getting lazy translation
re-enabled for Cinder.  It removes the use of gettextutils.install()
which is no longer needed with the addition of the explicit import
of _() in all of Cinder's files.  The configuration of 'cinder' catalog
is handled by gettextutils.

The install() function is replaced by gettextutils.enable_lazy() which
properly enables lazy translation when _() or _LX() is used.

Change-Id: I79e705f3852e8aa34034015199d56a8b23aeb8ef
Implements-Blueprint: i18n-enablement
This commit is contained in:
Jay S. Bryant 2014-07-08 14:04:56 -05:00 committed by Jay Bryant
parent eafcc41e82
commit ce86dbaa96
11 changed files with 11 additions and 9 deletions

View File

@ -45,7 +45,7 @@ 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()
# Need to register global_opts
from cinder.common import config # noqa

View File

@ -35,7 +35,7 @@ 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()
# Need to register global_opts
from cinder.common import config # noqa

View File

@ -39,7 +39,7 @@ 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()
# Need to register global_opts
from cinder.common import config # noqa

View File

@ -38,7 +38,7 @@ 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()
# Need to register global_opts
from cinder.common import config # noqa

View File

@ -73,7 +73,7 @@ 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()
# Need to register global_opts
from cinder.common import config # noqa

View File

@ -22,6 +22,7 @@ import sys
import rtslib
gettext.install('cinder-rtstool', unicode=1)
gettext.enable_lazy()
class RtstoolError(Exception):

View File

@ -39,7 +39,7 @@ 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()
# Need to register global_opts
from cinder.common import config # noqa

View File

@ -43,7 +43,7 @@ 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()
# Need to register global_opts
from cinder.common import config # noqa

View File

@ -53,7 +53,7 @@ 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()
from cinder import context
from cinder import db

View File

@ -18,7 +18,7 @@ import os
from oslo.config import cfg
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
gettextutils.enable_lazy()
from cinder.db.sqlalchemy import migrate_repo
from cinder import version

View File

@ -14,6 +14,7 @@
import datetime
from cinder.openstack.common.gettextutils import _
from cinder.openstack.common import log as logging
from oslo.config import cfg
from sqlalchemy import MetaData, Table