ugettext should be replaced with ugettext_lazy

Bug #1124276 reported by Joe T
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Joe T
Folsom
Fix Released
High
Joe T

Bug Description

It looks as though a handful of files are importing ugettext as _ instead of ugettext_lazy as _. This is causing some parts of Horizon to not be correctly translated after a user switches languages.

grep -R "ugettext " *

exposes which files need modified.

Revision history for this message
Joe T (joe-topjian-v) wrote :

Background information on ugettext vs ugettext_lazy is explained here: http://stackoverflow.com/questions/2694798/django-form-and-i18n

Julie Pichon (jpichon)
tags: added: low-hanging-fruit
Revision history for this message
Joe T (joe-topjian-v) wrote :

Just a heads up that I will have a Folsom patch submitted within the hour and most likely a master-branch patch, too.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/21889

Revision history for this message
Julie Pichon (jpichon) wrote :

Thanks Joe! It would be great to fix it in both places. Patches to the stable branch are also more likely to be accepted when they've been merged into the master branch first (http://wiki.openstack.org/StableBranch#Appropriate_Fixes).

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/21899

Changed in horizon:
status: New → In Progress
Revision history for this message
Joe T (joe-topjian-v) wrote :

Understood. I just submitted a patch for master.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/21905

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/21914

Changed in horizon:
assignee: nobody → Joe T (joe-topjian-v)
Revision history for this message
Joe T (joe-topjian-v) wrote :

OK, the initial changes I made were too aggressive and caused some templates to break. The new changes are a bit more conservative and only modify the files under the "dashboard" directory. This fixes the initial problem I found and does not cause any template problems.

The folsom changes have been tested in my production environment. The master changes have been tested in devstack.

Please let me know of any issues or anything that can be done better.

Thanks,
Joe

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/21914
Committed: http://github.com/openstack/horizon/commit/d107e4d9b5a6374007a0f265884b3b237d805eaf
Submitter: Jenkins
Branch: master

commit d107e4d9b5a6374007a0f265884b3b237d805eaf
Author: Joe Topjian <email address hidden>
Date: Wed Feb 13 21:44:49 2013 +0000

    Replaces ugettext with ugettext_lazy in the dashboard-related files

    While most files correctly import ugettext_lazy, some are importing ugettext instead.
    This is causing some parts of the dashboard to not translate correctly when a user
    switches languages. The core cause of this is because ugettext will translate the
    string once when the django application starts. ugettext_lazy will translate when the
    string is retrieved.

    Change-Id: Ibbdef60b3616d13aa7c2c5449ca592bf214a5f71
    Fixes: bug #1124276

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → grizzly-3
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/folsom)

Reviewed: https://review.openstack.org/21905
Committed: http://github.com/openstack/horizon/commit/c157d95eb2736e47020f592db22bf13eac0ed98a
Submitter: Jenkins
Branch: stable/folsom

commit c157d95eb2736e47020f592db22bf13eac0ed98a
Author: Joe Topjian <email address hidden>
Date: Wed Feb 13 19:54:41 2013 +0000

    Replaces ugettext with ugettext_lazy in the dashboard-related files

    While most files correctly import ugettext_lazy, some are importing ugettext instead.
    This is causing some parts of the dashboard to not translate correctly when a user
    switches languages. The core cause of this is because ugettext will translate the
    string once when the django application starts. ugettext_lazy will translate when the
    string is retrieved.

    Change-Id: I44a394f4cda3b0f019e5a4601d4fa44fc110f939
    Fixes: bug #1124276

Thierry Carrez (ttx)
Changed in horizon:
milestone: grizzly-3 → 2013.1
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.