diff options
author | Luis A. Garcia <luis@linux.vnet.ibm.com> | 2013-07-18 00:49:49 +0000 |
---|---|---|
committer | Luis A. Garcia <luis@linux.vnet.ibm.com> | 2013-08-03 00:19:17 +0000 |
commit | 9004239b9ffc7d1ef6ae3393a8d500e1d822af4a (patch) | |
tree | 6c7dd692b3577d0f8e60b71f5bb82dea13ce5a90 /bin | |
parent | 0af1565a5eefc2f040e955c1654518c3367758c1 (diff) | |
download | heat-9004239b9ffc7d1ef6ae3393a8d500e1d822af4a.tar.gz |
Enable localizable REST API responses via the Accept-Language header
Add support for doing language resolution for a request, based on the
Accept-Language HTTP header. Using the lazy gettext functionality, from
oslo gettextutils, it is possible to use the resolved language to
translate exception messages to the user requested language and
return that translation from the API.
The patch removes individually imported _() so they don't replace the
one installed service-wide.
Also, it adds the ability to fully re-create a remote error
with the same kwargs with which it was originally created, so that we
can translate it and show it to the user.
Partially implements bp user-locale-api.
Change-Id: I63edc8463836bfff257daa8a2c66ed5d3a444254
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/heat-api | 2 | ||||
-rwxr-xr-x | bin/heat-api-cfn | 2 | ||||
-rwxr-xr-x | bin/heat-api-cloudwatch | 2 | ||||
-rwxr-xr-x | bin/heat-cfn | 2 | ||||
-rwxr-xr-x | bin/heat-engine | 2 | ||||
-rwxr-xr-x | bin/heat-manage | 4 |
6 files changed, 9 insertions, 5 deletions
diff --git a/bin/heat-api b/bin/heat-api index 4ac438596..8f58c0944 100755 --- a/bin/heat-api +++ b/bin/heat-api @@ -33,7 +33,7 @@ if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): from heat.openstack.common import gettextutils -gettextutils.install('heat') +gettextutils.install('heat', lazy=True) from oslo.config import cfg diff --git a/bin/heat-api-cfn b/bin/heat-api-cfn index 8eceb6aef..95a946ca8 100755 --- a/bin/heat-api-cfn +++ b/bin/heat-api-cfn @@ -35,7 +35,7 @@ if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): from heat.openstack.common import gettextutils -gettextutils.install('heat') +gettextutils.install('heat', lazy=True) from oslo.config import cfg diff --git a/bin/heat-api-cloudwatch b/bin/heat-api-cloudwatch index 7453b7744..155a4d48f 100755 --- a/bin/heat-api-cloudwatch +++ b/bin/heat-api-cloudwatch @@ -35,7 +35,7 @@ if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): from heat.openstack.common import gettextutils -gettextutils.install('heat') +gettextutils.install('heat', lazy=True) from oslo.config import cfg diff --git a/bin/heat-cfn b/bin/heat-cfn index fc31938df..34a5bd0d8 100755 --- a/bin/heat-cfn +++ b/bin/heat-cfn @@ -41,7 +41,7 @@ scriptname = os.path.basename(sys.argv[0]) from heat.openstack.common import gettextutils -gettextutils.install('heat') +gettextutils.install('heat', lazy=True) 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 14e6f1851..36412cbae 100755 --- a/bin/heat-engine +++ b/bin/heat-engine @@ -36,7 +36,7 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')): from heat.openstack.common import gettextutils -gettextutils.install('heat') +gettextutils.install('heat', lazy=True) from oslo.config import cfg diff --git a/bin/heat-manage b/bin/heat-manage index 95e4a5d14..32bdc8f78 100755 --- a/bin/heat-manage +++ b/bin/heat-manage @@ -25,6 +25,10 @@ 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) +from heat.openstack.common import gettextutils + +gettextutils.install('heat') + from heat.cmd import manage manage.main() |