Django LocaleMiddleware determines the language for me. How do I know what language it determined?
I need to know what language it returns, so that I can perform my own actions.开发者_运维问答
from django.utils import translation
def myview(...):
...
lang = translation.get_language()
...
This will return the language code used in the current thread, so in your case, that set by the middleware.
templates with RequestContext have {{ LANGUAGE_CODE }} by default. http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/#other-tags
精彩评论