Mercurial > sat_legacy_website
diff templates/sat_website/base.html @ 25:930e73ea9e8e
select the current language in the languages selection list
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 19 Jan 2015 14:23:56 +0100 |
parents | 9bab976241dc |
children | 3df49721008c |
line wrap: on
line diff
--- a/templates/sat_website/base.html Sat Jan 17 21:37:19 2015 +0100 +++ b/templates/sat_website/base.html Mon Jan 19 14:23:56 2015 +0100 @@ -20,10 +20,10 @@ {% load staticfiles %} {% load i18n %} +{% get_current_language as LANGUAGE_CODE %} <!DOCTYPE html> -<html lang="en"> -<meta charset="utf-8"> +<html lang="{{ LANGUAGE_CODE }}"> <head> <link rel="stylesheet" href="{% static "css/bootstrap.css" %}"> <link rel="stylesheet" href="{% static "css/bootstrap-responsive.css" %}"> @@ -55,14 +55,13 @@ {% block content %}{% endblock %} <div class="container"> <div class="row" id="language"> - - <form class="well form-inline" action="/i18n/setlang/" method="post"> + <form class="well form-inline" action="{% url 'set_language' %}" method="post"> {% csrf_token %} <input name="next" type="hidden" value="{{ redirect_to }}" /> <select name="language"> {% get_language_info_list for available_languages as languages %} {% for language in languages %} - <option value="{{ language.code }}">{{ language.name_local }} ({{ language.code }})</option> + <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>{{ language.name_local }} ({{ language.code }})</option> {% endfor %} </select> <input type="submit" value="{% trans "Change language" %}" />