Sorry, I replied to your first post before I saw this one..

On Dec 19, 4:28 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi again,
> 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:

As I mentioned in my other post, it doesn't work for the one process.

I don't know if I really need to bother with the timestamp as you
outline below. I want the message files reloaded no matter what
whenever someone submits new translations using my app.

I'm probably understanding Python's 'global'  declaration imperfectly,
but from the print statements I have littered about in both my code
and Django's, the _translations object I'm referring to in my view
code doesn't seem to be the same object being referred to in
trans_real.py.

still looking,
James

>
> 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