Created
July 7, 2016 10:15
-
-
Save CapnKernel/bd06d876f0c522c9712c880c90b7c554 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% get_current_language as LANGUAGE_CODE %} | |
<div id="lang_section" class="float-right"> | |
<form action="{% url 'set_language' %}" method="post" id="base-lang-form"> | |
{% csrf_token %} | |
<select name="language" id="base-lang-selector"> | |
{% for lang in LANGUAGES %} | |
<option value="{{ lang.0 }}"{% if lang.0 == LANGUAGE_CODE %} selected{% endif %}>{% trans lang.1 %}</option> | |
{% endfor %} | |
</select> | |
</form> | |
<script type="text/javascript"> | |
$("#base-lang-selector").change(function() { | |
$("#base-lang-form").submit(); | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlpatterns = patterns('', | |
# Examples: | |
# url(r'^$', 'hv.views.home', name='home'), | |
# url(r'^hv/', include('hv.foo.urls')), | |
# Uncomment the admin/doc line below to enable admin documentation: | |
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | |
# ... | |
url(r'^i18n/setlang/$', 'django.views.i18n.set_language', name='set_language'), | |
url(r'^admin/', include(admin.site.urls)), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment