Thanks, it works!!!

Well, again a low-level function %-/, but I hope I won't use too much
of these magic low-level hacks.


On Dec 12, 4:07 pm, Rajesh Dhawan <rajesh.dha...@gmail.com> wrote:
> On Dec 12, 8:33 am, pihentagy <pihent...@gmail.com> wrote:
> > Hi all!
>
> > I started to write a cron job, which sends reminders to users, but run
> > into the following:
>
> > I do not know how to set the current language in this situation.
> > Setting settings.LANGUAGE_CODE has no effect.
>
> > Note, that not only the text in the mail should be different, but it
> > contains model data, and the model is aware of the current language
> > (uses get_language() to figure it out).
>
> > According to the docs 
> > here:http://docs.djangoproject.com/en/dev/topics/i18n/#id2
>
> > as I have no session, no request, no cookies, no http headers (it's a
> > cron job), the only chance is to look up the LANGUAGE_CODE for django.
>
> Perhaps try setting it through a low-level call to
> django.utils.translation.activate():
>
> from django.utils.translation import activate
> activate("en-US") # Replace "en-US" with the language code you want to
> activate.
>
> -Rajesh D
--~--~---------~--~----~------------~-------~--~----~
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