Support Accept-Language for API messages

Registered by Mathew Odden on 2013-06-26

Currently, error/exception messages coming back from Keystone are not translated at all. 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 a preferred locale before sending back the translated response. Alternatively, there is the possibility of using the tenant/user data to store a preferred locale for the request.

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:
Brant Knudson
Priority:
Medium
Drafter:
Mathew Odden
Direction:
Approved
Assignee:
Brant Knudson
Definition:
Approved
Series goal:
Accepted for icehouse
Implementation:
Implemented
Milestone target:
milestone icon 2014.1
Started by
Brant Knudson on 2013-08-02
Completed by
Dolph Mathews on 2014-01-23

Related branches

Sprints

Whiteboard

A good spot to do any checking and translation of exception messages is here:
https://github.com/openstack/keystone/blob/master/keystone/common/wsgi.py#L523

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

Addressed by: https://review.openstack.org/38832 (merged)
    Add support for API message localization

Addressed by: https://review.openstack.org/39176 (merged)
    Use keystone.wsgi.Request for RequestClass

---

Unfortunately, this was disabled late in the havana cycle. See https://etherpad.openstack.org/disable-lazy-translation

---

All we should need to do here is
a) wait for oslo changes
b) merge oslo changes
b) Change gettextutils.install to do lazy translation again (wherever we do gettextutils.install , e.g., keystone-all and http/keystone)

Addressed by: https://review.openstack.org/66680 (merged)
    Do not append to messages with +

Addressed by: https://review.openstack.org/66681 (merged)
    Sync gettextutils from oslo-incubator 997ab277

Addressed by: https://review.openstack.org/66682 (merged)
    Enable lazy translation

Addressed by: https://review.openstack.org/70610
    Add localized response test

(?)

Work Items

Work items:
Integrate common gettext utilities for delayed translations from oslo-incubator: TODO
Re-enable support Accept-Language header support and API layer translations: TODO

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.