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 Neutron 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:
Mark McClain
Priority:
Low
Drafter:
Mathew Odden
Direction:
Approved
Assignee:
Luis A. Garcia
Definition:
Obsolete
Series goal:
None
Implementation:
Good progress
Milestone target:
milestone icon next
Started by
Mathew Odden
Completed by
Armando Migliaccio

Related branches

Sprints

Whiteboard

Dec-16-2015(armax): If someone is interested in pursuing it, this must be re-submitted according to guidelines defined in [1].

[1] http://docs.openstack.org/developer/neutron/policies/blueprints.html

---------------

Neutron has a Fault class in the wsgi layer that would be good for doing the translation for error messages in.
https://github.com/openstack/neutron/blob/master/neutron/wsgi.py#L1076

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

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

Addressed by: https://review.openstack.org/39589
    Add common methods required to allow translation of REST API responses

Addressed by: https://review.openstack.org/39590
    Enable localizable REST API responses via the Accept-Language header

Addressed by: https://review.openstack.org/39591
    Externalize error messages in the API

---

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

Addressed by: https://review.openstack.org/66980
    Do not append to messages with +

(?)

Work Items

Work items:
Integrate common gettext utilities for delayed translations from oslo-incubator: DONE
Implement support Accept-Language header support and API layer translations: DONE
Additional translated messages for API error responses: DONE

This blueprint contains Public information 
Everyone can see this information.