Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#13973 closed (duplicate)

Get current language name filter in templates

Reported by: Secator <mariusz.jamro@…> Owned by: nobody
Component: Translations Version: 1.2
Severity: Keywords: language name
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Currently there's no way to retrieve current language name easily in templates. You can only use {% get_current_language ... %} filter to get the language code (eg. 'en-us' or 'de-de').
There should be a template filter in django.templatetags.i18n to get the "English" or "German" strings (verbose name of the language).

  ('de', 'German'),
  ('en', 'English'),

{% get_current_language as LANGUAGE_CODE %} # Existing filter. Returns en-us if language is english.
{% get_current_language_name as LANGUAGE_NAME %} # Proposed filter. Should return 'English' if LANGUAGE_CODE is 'en'. Basically should return the second element of settings.LANGUAGES touples.

Change History (2)

comment:1 Changed 8 years ago by Ramiro Morales

Resolution: duplicate
Status: newclosed

This is part of what has been proposed and discussed on #4030.

That ticket has been accepted by two core developers and has a patch that contains documentation and test (although it could be outdated, perhaps we could revive it and propose for 1.3). For that reason I'm closing this ticket as duplicate.

comment:2 Changed 7 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top