From 7a1c13aec30496abca8ba1fd8223b3d00f8cb912 Mon Sep 17 00:00:00 2001 From: David Stanek Date: Wed, 26 Mar 2014 15:58:32 +0000 Subject: [PATCH] Enable lazy translations in httpd/keystone.py This allows strings being returned in an HTTP response to be translated into the language specified in the HTTP requests headers. Closes-bug: #1297922 Change-Id: I8a671277f861075deddd1ee4cf5daca62a43fff7 --- httpd/keystone.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/httpd/keystone.py b/httpd/keystone.py index b5da6ac121..21761fd6bb 100644 --- a/httpd/keystone.py +++ b/httpd/keystone.py @@ -17,6 +17,13 @@ import os from paste import deploy +from keystone.openstack.common import gettextutils +# NOTE(dstanek): gettextutils.enable_lazy() must be called before +# gettextutils._() is called to ensure it has the desired lazy lookup +# behavior. This includes cases, like keystone.exceptions, where +# gettextutils._() is called at import time. +gettextutils.enable_lazy() + from keystone.common import dependency from keystone.common import environment from keystone.common import sql