From: Jay S. Bryant Date: Tue, 8 Jul 2014 19:04:56 +0000 (-0500) Subject: Enable lazy translation for Cinder X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ce86dbaa96e555c696c1306833e3d0717dfaf2d2;p=openstack-build%2Fcinder-build.git 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 --- diff --git a/bin/cinder-all b/bin/cinder-all index 6f26901d7..566273c26 100755 --- a/bin/cinder-all +++ b/bin/cinder-all @@ -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 diff --git a/bin/cinder-api b/bin/cinder-api index 6e83e7678..6be285476 100755 --- a/bin/cinder-api +++ b/bin/cinder-api @@ -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 diff --git a/bin/cinder-backup b/bin/cinder-backup index 69f2c76bf..fa747a63f 100755 --- a/bin/cinder-backup +++ b/bin/cinder-backup @@ -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 diff --git a/bin/cinder-clear-rabbit-queues b/bin/cinder-clear-rabbit-queues index bab50ec52..2328b2bef 100755 --- a/bin/cinder-clear-rabbit-queues +++ b/bin/cinder-clear-rabbit-queues @@ -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 diff --git a/bin/cinder-manage b/bin/cinder-manage index 512cb8f3d..a04483226 100755 --- a/bin/cinder-manage +++ b/bin/cinder-manage @@ -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 diff --git a/bin/cinder-rtstool b/bin/cinder-rtstool index 410524345..7801268e7 100755 --- a/bin/cinder-rtstool +++ b/bin/cinder-rtstool @@ -22,6 +22,7 @@ import sys import rtslib gettext.install('cinder-rtstool', unicode=1) +gettext.enable_lazy() class RtstoolError(Exception): diff --git a/bin/cinder-scheduler b/bin/cinder-scheduler index a01fe3e4e..cc04e2232 100755 --- a/bin/cinder-scheduler +++ b/bin/cinder-scheduler @@ -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 diff --git a/bin/cinder-volume b/bin/cinder-volume index 45c4ed461..f0fb798f9 100755 --- a/bin/cinder-volume +++ b/bin/cinder-volume @@ -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 diff --git a/bin/cinder-volume-usage-audit b/bin/cinder-volume-usage-audit index 3f223d38a..13cb1c231 100755 --- a/bin/cinder-volume-usage-audit +++ b/bin/cinder-volume-usage-audit @@ -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 diff --git a/cinder/db/sqlalchemy/migrate_repo/manage.py b/cinder/db/sqlalchemy/migrate_repo/manage.py index 7cb4d399d..d468a3107 100755 --- a/cinder/db/sqlalchemy/migrate_repo/manage.py +++ b/cinder/db/sqlalchemy/migrate_repo/manage.py @@ -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 diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/021_add_default_quota_class.py b/cinder/db/sqlalchemy/migrate_repo/versions/021_add_default_quota_class.py index 5c06e9c03..000aeab1d 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/021_add_default_quota_class.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/021_add_default_quota_class.py @@ -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