Hi again,

>
> Try something like this. Hopefully this will clear out the global
> translations and force a reload:
>
> translation.deactivate_all()
> globals _translations
> _translations = {}
> translation.activate(<translation language >)
>
> See django.utils.translation.trans_real for more.

On second thoughts, I think you will need to do more work than this
since this will only force a reload of the translations within the
current process. Other processes will have their own global
_translations cache and without further work those won't get reloaded.
If you try the above idea and it seems to work for one process (the
process of the request/view in which you run the above code), consider
the following:

Maintain the timestamp (say, catalog_change_timestamp) of when the
translation catalog last changed in a resource that all processes can
access (e.g. memcache, DB, or filesystem). Secondly, modify the above
snippet like this:

translation.deactivate_all()
globals _translations
_translations = {}
from datetime import datetime
globals _translations_loadtime
_translations_loadtime = datetime.now()
 translation.activate(<translation language >)

Lastly, add a custom middleware that checks the global
_translations_loadtime against catalog_change_timestamp and rerun the
above snippet. This should reset the translations in every process
that has not yet loaded your modified language catalog.

FAT DISCLAIMER: I have not tested any of this and am not at all sure
if this work. So, please take it with lots of salt.

-Rajesh
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to