Wiadomość napisana w dniu 2009-08-12, o godz. 13:00, przez Enrico  
Sartorello:

> i'm facing a problem developing with Django a Web Application: in
> response to some events (for example, after an admin action) i need to
> send emails to some users of my site.
>
> The problem arises when i want these emails to be translated in any
> user-specific language: the Request object i have just contains the
> language infos of the user that trigger the event, so it's not what i
> need.
> Generally, LocaleMiddleware behaviour can't do that job, because is
> based on sessions and cookies of a particular user.
> Roughly speaking i need (at least) a way to manually decide which is
> the language to apply for translations.

Once I needed to send emails in Hungarian from English application and  
this worked.

Before translating any string you need to know which language to use.  
If you have this information handy somewhere you can just switch the  
translation catalog safely in separated process environments (FastCGI,  
WSGI). As translation.activate() is process-wide, this approach is not  
safe in multithreaded environment if using static translation (not  
request-based).

-- 
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-users@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to