Udi h Bauman wrote: > Hi, > > I have a small question which I hope one of you experts will be kind > enough to help with. > > I wrote a web page which I need to translate to different languages > (http://staging.daylight-savings-time.info). I need to translate the day > & month names, which I generate using /strftime/. I need it to output > the date parts for a given locale. I've tried using setlocale, but it > apparently affected the full python process at the web server (it's a > Django app) & all user sessions. Is there a way to generate dates for a > given locale without setlocale? > > > Thanks a lot in advance! > Udi
One of the lookups django does to determine the current language is looking in the session for the key "django_language" [1] (this allows a specific language for each user). I see that you're using the set_language view (which updates the django_language var), so wheres the problem ? I've already translated the date and month names in Django, can't you reuse them (e.g. in the templates using the specific date filter) ? Note that the above behavior (setting and submitting the form in js) prevents search engines from indexing the other language pages. BTW, lazy loading of translations might be problematic, if that's the case (and only if thats the case), try to minimize the usage of them (e.g ugetgtext_lazy). [1] http://www.djangoproject.com/documentation/i18n/#how-django-discovers-language-preference Cheers -- Meir Kriheli http://mksoft.co.il _______________________________________________ Python-il mailing list [email protected] http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
