python - django : get the current locale inside a templatetag -


i've internationalized django (1.4) app.

in app, have templatetag needs know current language.

i think use django.utils.translation.get_language seems inside templatetag, returns default language , not current language.

i fixed reading request.language_code context.

but know if there better way language in templatetag

there's few default templatetags can use

{% get_current_language %} 

or

{% get_current_language foo %} 

e.g.

{% render_bar request foo %} 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -