Opened 14 years ago

Closed 14 years ago

Last modified 13 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

Description

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).

Example:

#settings.py:
LANGUAGES = (
  ('de', 'German'),
  ('en', 'English'),
)

#templates:
{% 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 by Ramiro Morales, 14 years ago

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 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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