How I get the current language in django?


Question

How can I get the current language in the current thread in a model or in the admin?

1
77
8/16/2017 4:18:07 PM

Accepted Answer

Functions of particular interest are django.utils.translation.get_language() which returns the language used in the current thread. See documentation.

119
11/29/2017 4:30:16 PM

Or you can also get this in your views

request.LANGUAGE_CODE

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon