I have project in Django 1.8. I want to have website with 3 languages, but when I choose language nothing happen:
Code in my template:
{% load i18n %}
...
<form action="{% url 'set_language' %}" method="post">
{% csrf_token %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<a href="{% url 'set_language' %}">{{ language.code }}</a>
{% endfor %}
<span class="glyphicon glyphicon-globe"></span>
</form>
My urls:
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'website.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'', include("www.urls", namespace="www")),
url(r'^blog/', include("blog.urls", namespace="blog")),
url(r'^admin/', include(admin.site.urls)),
url(r'^ckeditor/', include('ckeditor.urls')),
)
My settings (locale) - I use here django-rosetta:
LANGUAGE_CODE = 'en-us'
LANGUAGES = (
('pl', u'Poland'),
('en', u'US'),
('ru', u'Russia'),
)
LOCALE_PATHS = [
os.path.join(BASE_DIR, 'locale'),
]