some API responses which should be translated when using accept-language header are not

Bug #1221808 reported by Nicholas Goracke on 2013-09-06
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Undecided
Luis A. Garcia
OpenStack Heat
Fix Released
Undecided
Luis A. Garcia
OpenStack Identity (keystone)
Medium
Luis A. Garcia
neutron
Medium
Luis A. Garcia

Bug Description

1. Update cinder.po file
# vim /usr/lib/python2.6/site-packages/cinder/locale/ja/LC_MESSAGES/cinder.po
#: cinder/volume/flows/create_volume.py:301
#, python-format
msgid "Volume size %(size)s must be an integer and greater than 0"
msgstr "memo memo memo memo memo %(size)s memo memo memo memo memo memo memo memo memo memo memo memo memomemomeo meomeomeomeo 0."

2. Compile new .mo file, install
# msgfmt -o cinder.mo /usr/lib/python2.6/site-packages/cinder/locale/ja/LC_MESSAGES/cinder.po
# cp cinder.mo /usr/share/locale/ja_JP/LC_MESSAGES/
# cp cinder.mo /usr/share/locale/ja/LC_MESSAGES/

3. Restart cinder services
# service openstack-cinder-volume restart
# service openstack-cinder-scheduler restart
# service openstack-cinder-api restart

4. API call to trigger translated message
# curl -i http://127.0.0.1:8776/v1/89fb0710a5214d3596fb82e09d40fe4e/volumes -X POST -H "X-Auth-Project-Id: service" -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: 347ecfadfc2c4783a9fc0f24729eecaa" -d '{"volume": {"status": "creating", "availability_zone": null, "source_volid": null, "display_description": null, "snapshot_id": null, "user_id": null, "size": 0, "display_name": "volumetest", "imageRef": null, "attach_status": "detached", "volume_type": null, "project_id": null, "metadata": {}}}' -H "Accept-Language: ja"

5. Response still in "english'
HTTP/1.1 400
Content-Length: 119
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-b71abcbf-9dfb-4d92-8062-6338438c84a4
Date: Tue, 27 Aug 2013 03:21:05 GMT

{"badRequest": {"message": "Invalid input received: Volume size 0 must be an integer and greater than 0", "code": 400}}

6. Update system locale to make sure error message is properly translated
# cat /etc/sysconfig/i18n
LANG="ja_JP.UTF-8"
#LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"

7. Restart servers
# service openstack-cinder-volume restart
# service openstack-cinder-scheduler restart
# service openstack-cinder-api restart

8. Response is partial "translated".

[root@localhost locale]# curl -i http://127.0.0.1:8776/v1/89fb0710a5214d3596fb82e09d40fe4e/volumes -X POST -H "X-Auth-Project-Id: service" -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: 347ecfadfc2c4783a9fc0f24729eecaa" -d '{"volume": {"status": "creating", "availability_zone": null, "source_volid": null, "display_description": null, "snapshot_id": null, "user_id": null, "size": 0, "display_name": "volumetest", "imageRef": null, "attach_status": "detached", "volume_type": null, "project_id": null, "metadata": {}}}' -H "Accept-Language: ja"
HTTP/1.1 400
Content-Length: 182
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-49be059a-8e6a-4922-9349-e51028725f26
Date: Tue, 27 Aug 2013 03:28:00 GMT

{"badRequest": {"message": "Invalid input received: memo memo memo memo memo 0 memo memo memo memo memo memo memo memo memo memo memo memo memomemomeo meomeomeomeo 0.", "code": 400}}

9. Expected results:
The response in message should be "translated" without changing system local to ja

10. Actual results:
The response in message has not "translated".

Luis A. Garcia (luisg-8) on 2013-09-06
Changed in cinder:
assignee: nobody → Luis A. Garcia (luisg-8)

Fix proposed to branch: master
Review: https://review.openstack.org/45496

Changed in cinder:
status: New → In Progress
Luis A. Garcia (luisg-8) wrote :

We have identified similar instances of responses being partially translated in other components, where a Message is comprised of other Messages, and only the top level Message gets translated. Synchronizing the oslo-incubator patch across all should fix the problem.

Changed in keystone:
assignee: nobody → Luis A. Garcia (luisg-8)
Changed in heat:
assignee: nobody → Luis A. Garcia (luisg-8)
Changed in neutron:
assignee: nobody → Luis A. Garcia (luisg-8)

Fix proposed to branch: master
Review: https://review.openstack.org/47208

Changed in keystone:
status: New → In Progress

Fix proposed to branch: master
Review: https://review.openstack.org/47271

Changed in heat:
status: New → In Progress

Fix proposed to branch: master
Review: https://review.openstack.org/47276

Changed in neutron:
status: New → In Progress

Reviewed: https://review.openstack.org/45496
Committed: http://github.com/openstack/cinder/commit/afe2a213f7845cc66ca1036784bf7100d9159541
Submitter: Jenkins
Branch: master

commit afe2a213f7845cc66ca1036784bf7100d9159541
Author: Luis A. Garcia <email address hidden>
Date: Fri Sep 6 21:24:33 2013 +0000

    Sync gettextutils from oslo

    Some Messages, such as those created from Invalid exceptions, use a
    Message within a Message, and we were only translating the base Message
    but not the Message substitution within.

    Also adds test case for cinder case.

    Fixes bug: #1221808

    Change-Id: Ic3119df23a090cfaa160c1461e955f0af55fe1cf

Changed in cinder:
status: In Progress → Fix Committed

Reviewed: https://review.openstack.org/47276
Committed: http://github.com/openstack/neutron/commit/59196b62f93b052c51d2598d948a27815cb75f43
Submitter: Jenkins
Branch: master

commit 59196b62f93b052c51d2598d948a27815cb75f43
Author: Luis A. Garcia <email address hidden>
Date: Wed Sep 18 23:11:06 2013 +0000

    Sync gettextutils from oslo

    Some Messages, such as those created from Invalid exceptions, use a
    Message within a Message, and we were only translating the base Message
    but not the Message substitution within.

    Fixes bug: #1221808

    Change-Id: Ic3119df23a090cfaa160c1461e955f0af55fe1cf

Changed in neutron:
status: In Progress → Fix Committed
Changed in neutron:
importance: Undecided → Medium
milestone: none → havana-rc1
tags: added: translation

Reviewed: https://review.openstack.org/47271
Committed: http://github.com/openstack/heat/commit/0c674a09557bce261130d11cf87542aac6bbd26d
Submitter: Jenkins
Branch: master

commit 0c674a09557bce261130d11cf87542aac6bbd26d
Author: Luis A. Garcia <email address hidden>
Date: Wed Sep 18 22:19:29 2013 +0000

    Sync gettextutils from oslo

    Some Messages, like those from Invalid exceptions, use a Message within
    a Message, and we were only translating the base Message but not the
    Message substitution within.

    Fixes bug: #1221808

    Change-Id: Ic3119df23a090cfaa160c1461e955f0af55fe1cf

Changed in heat:
status: In Progress → Fix Committed
Dolph Mathews (dolph) on 2013-09-24
Changed in keystone:
importance: Undecided → Medium

Reviewed: https://review.openstack.org/47208
Committed: http://github.com/openstack/keystone/commit/8d55226320afdcd8bcc514566721113919e0d51a
Submitter: Jenkins
Branch: master

commit 8d55226320afdcd8bcc514566721113919e0d51a
Author: Luis A. Garcia <email address hidden>
Date: Wed Sep 18 17:03:55 2013 +0000

    Sync gettextutils from oslo

    Some Messages use a Message within a Message, and we were only
    translating the base Message but not the Message substitution within.

    Fixes bug: #1221808

    Change-Id: Ic3119df23a090cfaa160c1461e955f0af55fe1cf

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-10-02
Changed in keystone:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-03
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-03
Changed in heat:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-04
Changed in cinder:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in heat:
milestone: havana-rc1 → 2013.2
Thierry Carrez (ttx) on 2013-10-17
Changed in cinder:
milestone: havana-rc1 → 2013.2
Thierry Carrez (ttx) on 2013-10-17
Changed in neutron:
milestone: havana-rc1 → 2013.2
Thierry Carrez (ttx) on 2013-10-17
Changed in keystone:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers