Is there a built in templatetag to display a language name instead of language code?
Eg. I'm currently getting 'en' but I want 'English'
The i18n package provides the get_language_info
tag
{% load i18n %}
{% get_language_info for "en" as lang %}
{{lang.name_local}} ({{lang.code}})
will return:
English (en)
Substitute "en" in the above example for your template attribute
Eg. profile.language for my custom profile model was the attribute that was returning "en" by default - now I have a much prettier display for the language attribute
The above answers op question and comments from @art_hq supply an additional more generic solution using profile.language
as follows:
{% get_language_info for profile.language as lang %} {{ lang.name }}