summaryrefslogtreecommitdiff
path: root/httpd
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2013-07-25 17:43:36 -0500
committerBrant Knudson <bknudson@us.ibm.com>2013-08-14 18:09:01 -0500
commit760856e9669b0af20909c56d4a5a082bd4d7e450 (patch)
treeb32c7c0547d8ee19e5e4c954aa2d2d729d9d6057 /httpd
parent14e090154c10001550127628c2728013f15d4256 (diff)
downloadkeystone-760856e9669b0af20909c56d4a5a082bd4d7e450.tar.gz
Add support for API message localization
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 an exception message to the user requested language and return that translation from the API. Co-authored-by: Luis A. Garcia <luis@linux.vnet.ibm.com> Co-authored-by: Mathew Odden <mrodden@us.ibm.com> Implements bp user-locale-api Change-Id: Id8e92a42039d2f0b01d5c2dada733d068b2bdfeb
Diffstat (limited to 'httpd')
-rw-r--r--httpd/keystone.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/httpd/keystone.py b/httpd/keystone.py
index c73735494..492d2519e 100644
--- a/httpd/keystone.py
+++ b/httpd/keystone.py
@@ -7,7 +7,10 @@ from keystone.common import logging
from keystone import config
from keystone.openstack.common import gettextutils
-gettextutils.install('keystone')
+# NOTE(blk-u): Configure gettextutils for deferred translation of messages
+# so that error messages in responses can be translated according to the
+# Accept-Language in the request rather than the Keystone server locale.
+gettextutils.install('keystone', lazy=True)
LOG = logging.getLogger(__name__)
CONF = config.CONF