Lazy translation not used in LB panel (and elsewhere)

Bug #1178722 reported by Julie Pichon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Brooklyn

Bug Description

There are a number of places where we don't use lazily translated objects. It's particularly noticeable for the load balancer panel.

horizon/exceptions.py:28:from django.utils.translation import ugettext as _
horizon/templatetags/sizeformat.py:45: return translation.ungettext("%(size)d byte",
horizon/templatetags/sizeformat.py:49: return translation.ungettext("%(size)d",
horizon/templatetags/sizeformat.py:52: return translation.ugettext("%s KB") % \
horizon/templatetags/sizeformat.py:55: return translation.ugettext("%s MB") % \
horizon/templatetags/sizeformat.py:58: return translation.ugettext("%s GB") % \
horizon/templatetags/sizeformat.py:61: return translation.ugettext("%s TB") % \
horizon/templatetags/sizeformat.py:63: return translation.ugettext("%s PB") % \
horizon/templatetags/horizon.py:21:from django.utils.translation import ugettext as _
horizon/templatetags/branding.py:27:from django.utils.translation import ugettext as _
horizon/conf/default.py:2:from django.utils.translation import ugettext as _
horizon/utils/fields.py:5:from django.utils.translation import ugettext as _
horizon/base.py:39:from django.utils.translation import ugettext as _
horizon/decorators.py:27:from django.utils.translation import ugettext as _
horizon/workflows/base.py:27:from django.utils.translation import ugettext as _
openstack_dashboard/usage/base.py:7:from django.utils.translation import ugettext as _
openstack_dashboard/api/cinder.py:28:from django.utils.translation import ugettext as _
openstack_dashboard/api/nova.py:28:from django.utils.translation import ugettext as _
openstack_dashboard/dashboards/settings/user/forms.py:73: messages.success(request, translation.ugettext("Settings saved."))
openstack_dashboard/dashboards/project/instances/workflows/update_instance.py:22:from django.utils.translation import ugettext as _
openstack_dashboard/dashboards/project/loadbalancers/tabs.py:19:from django.utils.translation import ugettext as _
openstack_dashboard/dashboards/project/loadbalancers/views.py:21:from django.utils.translation import ugettext as _
openstack_dashboard/dashboards/project/loadbalancers/workflows.py:20:from django.utils.translation import ugettext as _
openstack_dashboard/dashboards/project/loadbalancers/tables.py:21:from django.utils.translation import ugettext as _
openstack_dashboard/dashboards/project/access_and_security/api_access/tables.py:17:from django.utils.translation import ugettext as _
openstack_dashboard/dashboards/admin/overview/views.py:22:from django.utils.translation import ugettext as _

These should use the _lazy version. https://docs.djangoproject.com/en/1.4/ref/utils/#module-django.utils.translation

Changed in horizon:
status: New → Confirmed
Brooklyn (yuanotes)
Changed in horizon:
assignee: nobody → Brooklyn (yuanotes)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
status: Confirmed → In Progress
Changed in horizon:
importance: Undecided → Medium
milestone: none → havana-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/28963
Committed: http://github.com/openstack/horizon/commit/08e6ed7392aa9d510833dee5b468140de10c22a6
Submitter: Jenkins
Branch: master

commit 08e6ed7392aa9d510833dee5b468140de10c22a6
Author: Brooklyn Chen <email address hidden>
Date: Tue May 14 14:05:42 2013 +0800

    Use ugettext_lazy instead of ugettext.

    We should use ugettext_lazy to let users in different languages
    get correct translation.Though in views or similar places
    we can use ugettext with no problems, we should make code
    style consistent.

    This also fix the issues that the django proxy objects appear on the
    launching instance page instead of translated strings. Now the
    translated quota strings are handled correctly.

    Fixes: bug #1178722

    Change-Id: I76f0d31e6546d70e5ece7e86a06f7eefd04861d2

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: havana-1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.