ugettext_lazy instead of ugettext for locale?

Asked by Joe T

Hello,

I'm not sure if this is a bug, so I wanted to post here first to confirm.

We want to support a french locale in Horizon and reviewed/modified the PO file to make sure it had proper entries for all supported areas. However, when switching from English to French, we find that not all areas are translated even though they are marked translatable in the code ( _("Foobar")).

I was able to resolve this issue by changing

from django.utils.translation import ugettext as _
to
from django.utils.translation import ugettext_lazy as _

This change enabled previously untranslated areas to become translated. The reason for this is described and further linked here (http://stackoverflow.com/questions/2694798/django-form-and-i18n).

An example of this can be seen by doing the above fix to "dashboards/nova/instances/workflows.py" (Folsom).

Can anyone confirm if this is a known issue or if this is a newly discovered bug?

Thanks,
Joe

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Dashboard (Horizon) Edit question
Assignee:
No assignee Edit question
Solved by:
Joe T
Solved:
Last query:
Last reply:
Revision history for this message
Joe T (joe-topjian-v) said :
#1

On further review through the code, it looks like only a handful of files have ugettext instead of ugettext_lazy -- I'm going to assume this is a bug and that all occurrences should be changed?

Revision history for this message
Julie Pichon (jpichon) said :
#2

I think you are correct, it sounds like a bug to me.

Revision history for this message
Joe T (joe-topjian-v) said :
#3

Sounds good. Thanks!