{# Django i18n No-Prefix Language Selector - Dropdown Style #} {% load i18n %} {# Context variables: - languages: List of dicts with 'code', 'name', 'is_current', 'switch_url' - current_language: Current language code - current_language_name: Current language display name - style: Widget style (dropdown/list/inline) - next_url: Optional URL to redirect after language change #}
{# Option 1: Native HTML select (recommended for accessibility) #}
{% if next_url %} {% endif %}
{# Option 2: Custom dropdown (Progressive Enhancement) #} {# Uncomment below for custom dropdown implementation #} {% comment %} {% endcomment %}
{# CSS helper classes for common frameworks #} {% comment %} Bootstrap 5 compatibility: - Add class="form-select" to select element - Add class="form-label" to label element - Wrap in div class="mb-3" Tailwind CSS compatibility: - Add class="block w-full rounded-md border-gray-300" to select - Add class="sr-only" instead of "visually-hidden" - Add class="text-sm font-medium text-gray-700" to label Pure CSS: - Use the BEM classes provided (.i18n-noprefix-selector__) - Style as needed in your CSS file {% endcomment %}