Support Accept-Language for API messages

Registered by Mathew Odden

Currently, error messages coming back from the API are translated using the same locale as the system the API is running on. Ideally, we would like to have the messages translated to the request senders locale, which we can support using the HTTP Accept-Language header to determine before sending back the translated response. Alternatively, there is the possibility of using the tenant/user data from Keystone to store a preferred locale.

There is a similar blueprint for Nova that can be used to track the implementation work there:
https://blueprints.launchpad.net/nova/+spec/user-locale-api

Blueprint information

Status:
Complete
Approver:
gordon chung
Priority:
Low
Drafter:
Mathew Odden
Direction:
Approved
Assignee:
Brad Pokorny
Definition:
Approved
Series goal:
Accepted for havana
Implementation:
Implemented
Milestone target:
milestone icon 2013.2
Started by
gordon chung
Completed by
gordon chung

Related branches

Sprints

Whiteboard

I think we could use the Pecan library's 'hooks' mechanism to capture Exceptions and translate the inner messages before returning/re-raising it. See here: http://pecan.readthedocs.org/en/latest/hooks.html

Gerrit topic: https://review.openstack.org/#q,topic:bp/user-locale-api,n,z

Addressed by: https://review.openstack.org/38668
    Add support for API message localization

Addressed by: https://review.openstack.org/39623
    Add support for API message localization

Addressed by: https://review.openstack.org/39993
    Sync gettextutils from oslo

Addressed by: https://review.openstack.org/42428
    Sync gettextutils from oslo-incubator

Addressed by: https://review.openstack.org/42940
    Sync gettextutils from oslo-incubator

Addressed by: https://review.openstack.org/42972
    Enhance delayed message translation when _ is imported

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.