Ticket #5494: i18n_and_tests2.diff

File i18n_and_tests2.diff, 1.6 KB (added by Claude Paroz, 14 years ago)

Test in views instead of i18n

  • 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:
  • tests/regressiontests/views/tests/i18n.py

    diff --git a/tests/regressiontests/views/tests/i18n.py b/tests/regressiontests/views/tests/i18n.py
    index de023be..582c2b9 100644
    a b  
    11# -*- coding:utf-8 -*-
    22import gettext
     3import os
    34
    45from django.conf import settings
    56from django.test import TestCase
    class JsI18NTestsMultiPackage(TestCase):  
    136137        response = self.client.get('/views/jsi18n_multi_packages2/')
    137138        self.assertContains(response, javascript_quote('este texto de app3 debe ser traducido'))
    138139        deactivate()
     140
     141    def testI18NWithLocalePaths(self):
     142        settings.LANGUAGE_CODE = 'es-ar'
     143        self.old_locale_paths = settings.LOCALE_PATHS
     144        settings.LOCALE_PATHS += (os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'app3', 'locale'),)
     145        response = self.client.get('/views/jsi18n/')
     146        self.assertContains(response, javascript_quote('este texto de app3 debe ser traducido'))
     147        settings.LOCALE_PATHS = self.old_locale_paths
Back to Top