From 48b243b35e020bee2d850389b059961a296f4dc2 Mon Sep 17 00:00:00 2001 From: Liang Chen Date: Sun, 30 Jun 2013 14:42:41 +0800 Subject: [PATCH] install "_" via gettextutils avoid using two separate sets of translation messages when HEAT_LOCALEDIR environment variable presents. Fixes bug #1196184 Change-Id: Ief773b9f2674909de461e2b07f1b07d3c66521cc --- bin/heat-api | 5 +++-- bin/heat-api-cfn | 5 +++-- bin/heat-api-cloudwatch | 5 +++-- bin/heat-cfn | 5 +++-- bin/heat-engine | 5 +++-- bin/heat-watch | 5 +++-- heat/api/aws/ec2token.py | 5 +++-- heat/api/cfn/__init__.py | 5 +++-- heat/api/cloudwatch/__init__.py | 5 +++-- heat/api/openstack/v1/__init__.py | 5 +++-- heat/db/sync.py | 6 +++--- 11 files changed, 33 insertions(+), 23 deletions(-) diff --git a/bin/heat-api b/bin/heat-api index 9dc6943e..4ac43859 100755 --- a/bin/heat-api +++ b/bin/heat-api @@ -20,7 +20,6 @@ Heat API Server. An OpenStack ReST API to Heat. import eventlet eventlet.monkey_patch(os=False) -import gettext import os import sys @@ -32,7 +31,9 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): sys.path.insert(0, possible_topdir) -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from oslo.config import cfg diff --git a/bin/heat-api-cfn b/bin/heat-api-cfn index db414d19..8eceb6ae 100755 --- a/bin/heat-api-cfn +++ b/bin/heat-api-cfn @@ -22,7 +22,6 @@ calls the heat-engine via AMQP RPC to implement them. import eventlet eventlet.monkey_patch(os=False) -import gettext import os import sys @@ -34,7 +33,9 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): sys.path.insert(0, possible_topdir) -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from oslo.config import cfg diff --git a/bin/heat-api-cloudwatch b/bin/heat-api-cloudwatch index acd95bfb..7453b774 100755 --- a/bin/heat-api-cloudwatch +++ b/bin/heat-api-cloudwatch @@ -22,7 +22,6 @@ calls the heat-engine via AMQP RPC to implement them. import eventlet eventlet.monkey_patch(os=False) -import gettext import os import sys @@ -34,7 +33,9 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): sys.path.insert(0, possible_topdir) -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from oslo.config import cfg diff --git a/bin/heat-cfn b/bin/heat-cfn index b26461aa..fc31938d 100755 --- a/bin/heat-cfn +++ b/bin/heat-cfn @@ -20,7 +20,6 @@ belonging to a user. It is a convenience application that talks to the heat API server. """ -import gettext import optparse import os import os.path @@ -40,7 +39,9 @@ if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): scriptname = os.path.basename(sys.argv[0]) -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') if scriptname == 'heat-boto': from heat.cfn_client import boto_client as heat_client diff --git a/bin/heat-engine b/bin/heat-engine index ef885b1d..3e0167a4 100755 --- a/bin/heat-engine +++ b/bin/heat-engine @@ -20,7 +20,6 @@ calls made by the user. Normal communications is done via the heat API which then calls into this engine. """ -import gettext import eventlet eventlet.monkey_patch() @@ -35,7 +34,9 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from oslo.config import cfg diff --git a/bin/heat-watch b/bin/heat-watch index 12e4264a..21b97417 100755 --- a/bin/heat-watch +++ b/bin/heat-watch @@ -20,7 +20,6 @@ information about the cloudwatch alarms and metrics belonging to a user. It is a convenience application that talks to the heat Cloudwatch API server. """ -import gettext import optparse import os import os.path @@ -38,7 +37,9 @@ if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): scriptname = os.path.basename(sys.argv[0]) -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from heat.cfn_client import boto_client_cloudwatch as heat_client from heat.version import version_info as version diff --git a/heat/api/aws/ec2token.py b/heat/api/aws/ec2token.py index daaf32b8..4ad18507 100644 --- a/heat/api/aws/ec2token.py +++ b/heat/api/aws/ec2token.py @@ -15,10 +15,11 @@ import urlparse import httplib -import gettext import hashlib -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from heat.common import wsgi from heat.openstack.common import jsonutils as json diff --git a/heat/api/cfn/__init__.py b/heat/api/cfn/__init__.py index b39691f4..b7e12f74 100644 --- a/heat/api/cfn/__init__.py +++ b/heat/api/cfn/__init__.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -import gettext +from heat.openstack.common import gettextutils + +gettextutils.install('heat') -gettext.install('heat', unicode=1) from heat.api.middleware.version_negotiation import VersionNegotiationFilter from heat.api.cfn import versions diff --git a/heat/api/cloudwatch/__init__.py b/heat/api/cloudwatch/__init__.py index f8567bd0..a49db0df 100644 --- a/heat/api/cloudwatch/__init__.py +++ b/heat/api/cloudwatch/__init__.py @@ -14,9 +14,10 @@ # under the License. import routes -import gettext -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from heat.api.cloudwatch import watch from heat.common import wsgi diff --git a/heat/api/openstack/v1/__init__.py b/heat/api/openstack/v1/__init__.py index 2f65ad81..cb2f17b5 100644 --- a/heat/api/openstack/v1/__init__.py +++ b/heat/api/openstack/v1/__init__.py @@ -14,9 +14,10 @@ # under the License. import routes -import gettext -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from heat.api.openstack.v1 import stacks from heat.api.openstack.v1 import resources diff --git a/heat/db/sync.py b/heat/db/sync.py index d95d6c55..9eac7799 100755 --- a/heat/db/sync.py +++ b/heat/db/sync.py @@ -16,11 +16,11 @@ from __future__ import print_function -import gettext - import sys -gettext.install('heat', unicode=1) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') from oslo.config import cfg from heat.openstack.common import log as logging -- 2.45.2