Ticket #18700: 18700b.diff

File 18700b.diff, 2.0 KB (added by Simon Meers, 12 years ago)

Forgot quotes

  • django/conf/urls/i18n.py

    diff --git a/django/conf/urls/i18n.py b/django/conf/urls/i18n.py
    index 6e56af8..7f2fc23 100644
    a b  
    11from django.conf import settings
    2 from django.conf.urls import patterns
     2from django.conf.urls import patterns, url
    33from django.core.urlresolvers import LocaleRegexURLResolver
    44
    55def i18n_patterns(prefix, *args):
    def i18n_patterns(prefix, *args):  
    1616
    1717
    1818urlpatterns = patterns('',
    19     (r'^setlang/$', 'django.views.i18n.set_language'),
     19    url(r'^setlang/$', 'django.views.i18n.set_language', name='setlang'),
    2020)
  • docs/topics/i18n/translation.txt

    diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt
    index 988948e..40ba93c 100644
    a b Here's example HTML template code:  
    12721272
    12731273.. code-block:: html+django
    12741274
    1275     <form action="/i18n/setlang/" method="post">
     1275    <form action="{% url 'setlang' %}" method="post">
    12761276    {% csrf_token %}
    12771277    <input name="next" type="hidden" value="{{ redirect_to }}" />
    12781278    <select name="language">
  • tests/regressiontests/views/tests/i18n.py

    diff --git a/tests/regressiontests/views/tests/i18n.py b/tests/regressiontests/views/tests/i18n.py
    index 9993ae9..c5b45b8 100644
    a b import gettext  
    55from os import path
    66
    77from django.conf import settings
     8from django.core.urlresolvers import reverse
    89from django.test import TestCase
    910from django.utils.translation import override, activate, get_language
    1011from django.utils.text import javascript_quote
    class I18NTests(TestCase):  
    2324            self.assertRedirects(response, 'http://testserver/views/')
    2425            self.assertEqual(self.client.session['django_language'], lang_code)
    2526
     27    def test_setlang_reversal(self):
     28        self.assertEqual(reverse('setlang'), '/views/i18n/setlang/')
     29
    2630    def test_jsi18n(self):
    2731        """The javascript_catalog can be deployed with language settings"""
    2832        saved_lang = get_language()
Back to Top