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 now
possible to use the resolved language to translate an exception message
to the user requested language and return that translation from the API.

Partially implements bp user-locale-api

Change-Id: Ib2c8360372996d53b50542df54a52d92b07295ca
This commit is contained in:
Luis A. Garcia
2013-07-08 23:11:05 +00:00
parent 881c73263c
commit 2086a91059
7 changed files with 66 additions and 10 deletions

View File

@@ -204,7 +204,8 @@ class Server(object):
backlog=backlog)
self._server = eventlet.spawn(self._start)
(self._host, self._port) = self._socket.getsockname()[0:2]
LOG.info(_("Started %(name)s on %(_host)s:%(_port)s") % self.__dict__)
LOG.info(_("Started %(name)s on %(host)s:%(port)s") %
{'name': self.name, 'host': self.host, 'port': self.port})
@property
def host(self):