diff --git a/django/conf/urls/i18n.py b/django/conf/urls/i18n.py
index 6e56af8..426c2b2 100644
a
|
b
|
|
1 | 1 | from django.conf import settings |
2 | | from django.conf.urls import patterns |
| 2 | from django.conf.urls import patterns, url |
3 | 3 | from django.core.urlresolvers import LocaleRegexURLResolver |
4 | 4 | |
5 | 5 | def i18n_patterns(prefix, *args): |
… |
… |
def i18n_patterns(prefix, *args):
|
16 | 16 | |
17 | 17 | |
18 | 18 | urlpatterns = patterns('', |
19 | | (r'^setlang/$', 'django.views.i18n.set_language'), |
| 19 | url(r'^setlang/$', 'django.views.i18n.set_language', name='set_language'), |
20 | 20 | ) |
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt
index 988948e..bdbb048 100644
a
|
b
|
Here's example HTML template code:
|
1272 | 1272 | |
1273 | 1273 | .. code-block:: html+django |
1274 | 1274 | |
1275 | | <form action="/i18n/setlang/" method="post"> |
| 1275 | <form action="{% url 'set_language' %}" method="post"> |
1276 | 1276 | {% csrf_token %} |
1277 | 1277 | <input name="next" type="hidden" value="{{ redirect_to }}" /> |
1278 | 1278 | <select name="language"> |
diff --git a/tests/regressiontests/views/tests/i18n.py b/tests/regressiontests/views/tests/i18n.py
index 9993ae9..cb58026 100644
a
|
b
|
import gettext
|
5 | 5 | from os import path |
6 | 6 | |
7 | 7 | from django.conf import settings |
| 8 | from django.core.urlresolvers import reverse |
8 | 9 | from django.test import TestCase |
9 | 10 | from django.utils.translation import override, activate, get_language |
10 | 11 | from django.utils.text import javascript_quote |
… |
… |
class I18NTests(TestCase):
|
23 | 24 | self.assertRedirects(response, 'http://testserver/views/') |
24 | 25 | self.assertEqual(self.client.session['django_language'], lang_code) |
25 | 26 | |
| 27 | def test_setlang_reversal(self): |
| 28 | self.assertEqual(reverse('set_language'), '/views/i18n/setlang/') |
| 29 | |
26 | 30 | def test_jsi18n(self): |
27 | 31 | """The javascript_catalog can be deployed with language settings""" |
28 | 32 | saved_lang = get_language() |