This Django app contains a decorator function which allows the /jsi18n/ django.views.i18n.javascript_catalog to be cached by the browser. It assumes that your site is using version numbers in URLs similar to the way that is described on page 30 of the presentation slides for the "Engaging User Experiences with Google App Engine" Google I/O talk. This has been tested with the stock Django 0.96 included in Google App Engine.
Download
Installation
- Copy the entire
jsi18ncache/directory into your django project alongside your other django apps. - Add
'jsi18ncache'toINSTALLED_APPSinsettings.py - In your
urls.py, change(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
to(r'^.*/jsi18n/$', 'jsi18ncache.views.javascript_catalog', js_info_dict), - Change the
<script>tag in your your HTML templates and pages to something along the lines of:{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<script type="text/javascript" src="/{{appversion}}/jsi18n/?language={{LANGUAGE_CODE}}"></script>
