Wiadomość napisana w dniu 2010-02-16, o godz. 22:12, przez Plovarna:
I just developing my first aplication with internationalization. I
need to get all verbose_name values of the model for each language
defined in settings.LANGUAGES. I do it by this code defined inside
model method :
current_lang = get_language()
names = {}
for lang in settings.LANGUAGES:
activate(lang[0])
class_name = unicode(self.__class__._meta.verbose_name)
names.append(class_name)
deactivate()
activate(current_lang)
My question is: Is this approach thread safe? Is there any other way
how to get verbose_name of the model for each defined language?
From the code it looks like this is thread safe, thread-local seems
to be used to store the translation catalog.
--
Artificial intelligence stands no chance against natural stupidity
Jarek Zgoda, R&D, Redefine
jarek.zg...@redefine.pl
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.