django, change language settings dynamically
After some failed attempts, I just found how to change the language settings dynamically in django, and I thought it could be useful to someone. Just use function activate() from django.utils.translation. For example:
from django.utils.translation import activate
activate('es-ES')
activate('es-ES')
will change global language settings to ‘es-ES’ (Spain spanish). I use it because I have two forms and I want that errors appear in different languages, but I do not want to get into gettext
February 16th, 2010 10:02
Thanks a lot!
You prob
February 16th, 2010 10:02
Thanks a lot, Fabian!!
You probably saved me a few hours!!!
March 6th, 2010 21:35
Thanks for this blog. I am new at development and this got me straight.
March 7th, 2010 01:25
This is great! Thanks for this blog. I am starting python and this will help a lot.
March 10th, 2010 13:40
For the reason that a Newbie I am incessantly scouring the web on the web to get this type of information .Thank you:P
May 21st, 2010 06:40
Fabian,
Is there a way to set other Django settings dynamically, specifically I am looking to change the email_host? Thanks
March 4th, 2011 16:01
God Bless You! Thx!
October 25th, 2011 14:12
Thanks a lot bro..