ugettext should be replaced with ugettext_lazy

Bug #1124276 reported by Joe T on 2013-02-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Undecided
Joe T
Folsom
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.

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) on 2013-02-13
tags: added: low-hanging-fruit
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.

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

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

Changed in horizon:
status: New → In Progress
Joe T (joe-topjian-v) wrote :

Understood. I just submitted a patch for master.

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

Changed in horizon:
assignee: nobody → Joe T (joe-topjian-v)
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

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) on 2013-02-21
Changed in horizon:
milestone: none → grizzly-3
status: Fix Committed → Fix Released

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) on 2013-04-04
Changed in horizon:
milestone: grizzly-3 → 2013.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers