Angular code should not reference global gettext

Bug #1446739 reported by Matt Borland
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
In Progress
Low
Unassigned

Bug Description

Currently Django provides a window-global function gettext() (among others) that is used for presenting translated text. This mechanism is still needed, but it currently is not presented as a service (/factory). This means that the Angular code expects gettext() to be on the global scope, which is not only a bad practice but interferes with testing (having to supply a global-scope mechanism).

The solution is to create a service (through a factory probably) that provides a function through injection.

The rollout of this may be done in phases:
 - Create factory and example
 - Continue to expand use throughout existing code base
 - In some contexts, may actually delete the gettext reference from the global scope

Tags: angularjs
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/175976

Changed in horizon:
assignee: nobody → Matt Borland (palecrow)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/175976
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=a75f126bac0e6a707929f48a4230fc954334a583
Submitter: Jenkins
Branch: master

commit a75f126bac0e6a707929f48a4230fc954334a583
Author: Matt Borland <email address hidden>
Date: Tue Apr 21 10:29:12 2015 -0600

    Add Angular service to provide translation

    Adds a service that provides an injectable service wrapping the existing
    translation mechanism. This helps with testing and abstracts away the
    particular translation mechanism. Applying the use of this service would
    allow the code to reduce implicit dependencies on globally-scoped items.

    Change-Id: Iff4e66996760810adf4ba4ac1b63a86313a042ed
    Partial-Bug: 1446739

Changed in horizon:
assignee: Matt Borland (palecrow) → Tyr Johanson (tyr-6)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by David Lyle (<email address hidden>) on branch: master
Review: https://review.openstack.org/180157
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Changed in horizon:
importance: Undecided → Low
milestone: none → next
Akihiro Motoki (amotoki)
tags: added: angularjs
Changed in horizon:
assignee: Tyr Johanson (tyr-6) → nobody
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.