add language selector, use set_language redirect view from django
This commit is contained in:
parent
e38e0bda55
commit
b1afe75a62
@ -76,6 +76,27 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
<ul class="nav navbar-nav pull-right">
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-language fa-fw"></i> {{ LANGUAGE_CODE }} <b class="caret"></b></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
{% get_language_info_list for LANGUAGES as langs %}
|
||||||
|
{% for lang in langs %}
|
||||||
|
{% if lang.code != LANGUAGE_CODE %}
|
||||||
|
<li>
|
||||||
|
<form name="setLang{{ lang.name }}" action="{% url 'set_language' %}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="language" value="{{ lang.code }}" />
|
||||||
|
<a href="#" onclick="document.setLang{{ lang.name }}.submit();return false;">
|
||||||
|
{{ lang.name_local }} ({{ lang.name }}) [{{ lang.code }}]
|
||||||
|
</a>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,6 +32,7 @@ urlpatterns = patterns(
|
|||||||
# registration and user settings
|
# registration and user settings
|
||||||
url(r'^account/', include('nsupdate.accounts.urls')),
|
url(r'^account/', include('nsupdate.accounts.urls')),
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
|
url(r'^i18n/', include('django.conf.urls.i18n')),
|
||||||
url(r'^', include('nsupdate.main.urls')),
|
url(r'^', include('nsupdate.main.urls')),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user