← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1221808] Re: some API responses which should be translated when using accept-language header are not

 

** Changed in: neutron
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1221808

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

Status in Cinder:
  Fix Committed
Status in Orchestration API (Heat):
  Fix Committed
Status in OpenStack Identity (Keystone):
  Fix Released
Status in OpenStack Neutron (virtual network service):
  Fix Released

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".

To manage notifications about this bug go to:
https://bugs.launchpad.net/cinder/+bug/1221808/+subscriptions