Django i18n and python locales (and dates)

I played with the Django i18n system and it seems to work mostly. However, the dates in the model code seem to be causing problems.

I use datetime.strftime to populate several CHOICES tuples, which are then used in forms.

From what I understood, django will set the locale for user selection, so datetime.strftime () will be output in the appropriate language, but this does not seem to happen.

What am I missing here?

If I set the locale manually (for example, locale.setlocale (locale.LC_TIME, 'de_DE.UTF-8')), then datetime translates correctly.

Thanks,

Tom

+5
source share
2 answers

Django , . , ( , ), . Babel, Django.

+3

, , format python strftime

+1

All Articles