| 9 | This was my configuration: |
| 10 | |
| 11 | urls.py |
| 12 | |
| 13 | |
| 14 | {{{ |
| 15 | js_info_dict = { |
| 16 | 'packages': ('market',), |
| 17 | } |
| 18 | |
| 19 | urlpatterns = [url(r'^jsi18n/$', javascript_catalog, js_info_dict), ] |
| 20 | |
| 21 | urlpatterns += i18n_patterns( |
| 22 | url(r'^$', HomePage.as_view(), name='home'), |
| 23 | ) |
| 24 | }}} |
| 25 | |
| 26 | |
| 27 | settings.py |
| 28 | |
| 29 | {{{ |
| 30 | |
| 31 | LOCALE_PATHS = ( |
| 32 | pjoin(BASE_DIR, '00', 'locale'), |
| 33 | ) |
| 34 | |
| 35 | # Middleware =================================================================== |
| 36 | MIDDLEWARE_CLASSES = ( |
| 37 | 'django.contrib.sessions.middleware.SessionMiddleware', |
| 38 | 'django.middleware.locale.LocaleMiddleware', |
| 39 | 'django.middleware.common.CommonMiddleware', |
| 40 | 'django.middleware.csrf.CsrfViewMiddleware', |
| 41 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 42 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', |
| 43 | 'django.contrib.messages.middleware.MessageMiddleware', |
| 44 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 45 | 'django.middleware.security.SecurityMiddleware', |
| 46 | ) |
| 47 | |
| 48 | # Internationalization ========================================================= |
| 49 | LANGUAGE_CODE = 'en' |
| 50 | TIME_ZONE = 'Europe/Paris' |
| 51 | USE_I18N = True |
| 52 | USE_L10N = True |
| 53 | USE_TZ = True |
| 54 | LANGUAGES = ( |
| 55 | ('en', gettext_noop('English')), |
| 56 | ('fr', gettext_noop('French')), |
| 57 | ) |
| 58 | }}} |
| 59 | |
| 60 | |
| 61 | home.html (The script is successfully loaded) |
| 62 | |
| 63 | |
| 64 | {{{ |
| 65 | <script type="text/javascript" src="{% url 'django.views.i18n.javascript_catalog' %}"></script> |
| 66 | |
| 67 | }}} |
| 68 | |