Localization of text in a variable

9 views
Skip to first unread message

Salvatore Iovene

unread,
Jun 19, 2012, 8:47:31 AM6/19/12
to django...@googlegroups.com
Hi,
I'm having the following code:

Models:

untranslated = "Foo"
translated = ugettext(untranslated)  # Hopefully "makemessages" will read this
insert_in_database(untranslated)

Later in a View:

text = get_from_database();

And I pass it to a template where I do:

{% trans text %}

This is not working (although I swear it was working when I first wrote it!)

Do you know how to get this work?
Please do not suggest that I don't store text that will be translated in the database, because I would have to do a lot of hacking on a third party component to make it work that way :)

Thank you!
Reply all
Reply to author
Forward
0 new messages