Ticket #5494: i18n_and_tests.diff

File i18n_and_tests.diff, 2.6 KB (added by Claude Paroz, 14 years ago)

Same as i18n.diff + tests

  • django/views/i18n.py

    diff --git a/django/views/i18n.py b/django/views/i18n.py
    index 133c42f..d55d5aa 100644
    a b def javascript_catalog(request, domain='djangojs', packages=None):  
    211211                en_catalog_missing = True
    212212            # Otherwise it is harmless.
    213213            pass
     214    paths.extend(settings.LOCALE_PATHS)
    214215    # next load the settings.LANGUAGE_CODE translations if it isn't english
    215216    if default_locale != 'en':
    216217        for path in paths:
  • new file tests/regressiontests/i18n/other/locale/de/LC_MESSAGES/djangojs.po

    diff --git a/tests/regressiontests/i18n/other/locale/de/LC_MESSAGES/djangojs.po b/tests/regressiontests/i18n/other/locale/de/LC_MESSAGES/djangojs.po
    new file mode 100644
    index 0000000..1b32c76
    - +  
     1msgid ""
     2msgstr ""
     3"Project-Id-Version: Django\n"
     4"Report-Msgid-Bugs-To: \n"
     5"POT-Creation-Date: 2010-05-05 00:38+0200\n"
     6"PO-Revision-Date: 2008-06-23 21:02+0100\n"
     7"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
     8"Language-Team: \n"
     9"MIME-Version: 1.0\n"
     10"Content-Type: text/plain; charset=UTF-8\n"
     11"Content-Transfer-Encoding: 8bit\n"
     12"Plural-Forms: nplurals=2; plural=(n != 1)\n"
     13
     14#: test.js:1
     15msgid "Thanks Django"
     16msgstr "Danke Django"
     17
  • tests/regressiontests/i18n/tests.py

    diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py
    index 615ffe8..c3e8d05 100644
    a b class AppResolutionOrderI18NTests(ResolutionOrderI18NTests):  
    652652        self.assertUgettext('Date/time', 'APP')
    653653
    654654class LocalePathsResolutionOrderI18NTests(ResolutionOrderI18NTests):
     655    urls = 'regressiontests.i18n.urls'
    655656
    656657    def setUp(self):
    657658        self.old_locale_paths = settings.LOCALE_PATHS
    class LocalePathsResolutionOrderI18NTests(ResolutionOrderI18NTests):  
    665666    def test_locale_paths_translation(self):
    666667        self.assertUgettext('Date/time', 'LOCALE_PATHS')
    667668
     669    def test_locale_paths_js_translation(self):
     670        response = self.client.get('/jsi18n/')
     671        self.assertContains(response, "catalog['Thanks Django'] = 'Danke Django';")
     672
    668673class ProjectResolutionOrderI18NTests(ResolutionOrderI18NTests):
    669674
    670675    def setUp(self):
  • new file tests/regressiontests/i18n/urls.py

    diff --git a/tests/regressiontests/i18n/urls.py b/tests/regressiontests/i18n/urls.py
    new file mode 100644
    index 0000000..42e3ce7
    - +  
     1# coding: utf-8
     2from django.conf.urls.defaults import *
     3
     4urlpatterns = patterns('',
     5    (r'^jsi18n/$', 'django.views.i18n.javascript_catalog'),
     6)
Back to Top