django-statici18n
Overview
When dealing with internationalization in JavaScript code, Django provides the JSONCatalog view which sends out a JavaScript code library with functions that mimic the gettext interface, plus an array of translation strings.
At first glance, it works well and everything is fine. But, because JSONCatalog view is generating JavaScript catalog dynamically on each and every request, it’s adding an overhead that can be an issue with site growth.
That’s what django-statici18n is for:
Collecting JavaScript catalogs from each of your Django apps (and any other place you specify) into a single location that can easily be served in production.
The main website for django-statici18n is github.com/zyegfryed/django-statici18n where you can also file tickets.
Supported Django Versions
django-statici18n works with all the Django versions officially supported by the Django project. At this time of writing, these are the 5.2 (LTS), 6.0 and 6.1 series.
Installation
Use your favorite Python packaging tool to install django-statici18n from PyPI, e.g.:
pip install django-statici18n
Add 'statici18n' to your INSTALLED_APPS setting:
INSTALLED_APPS = [ # ... 'statici18n', ]Once you have translated and compiled your messages, use the compilejsi18n management command:
python manage.py compilejsi18n
Add the django.core.context_processors.i18n context processor to the context_processors section for your backend in the TEMPLATES setting - it should have already been set by Django:
TEMPLATES = [ { # ... 'OPTIONS': { 'context_processors': { # ... 'django.template.context_processors.i18n', }, }, }, ]Edit your template(s) and replace the dynamically generated script by the statically generated one:
<script src="{{ STATIC_URL }}jsi18n/{{ LANGUAGE_CODE }}/djangojs.js"></script>
(Optional)
The following step assumes you’re using django.contrib.staticfiles.
Edit your template(s) and use the provided template tag:
{% load statici18n %} <script src="{% statici18n LANGUAGE_CODE %}"></script>
Or inline the JavaScript directly in your template:
{% load statici18n %} <script>{% inlinei18n LANGUAGE_CODE %}</script>
Metadata
Release files for django-statici18n 2.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_statici18n-2.8.0.tar.gz | 8.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_statici18n-2.8.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 17.4 kB
Release files / django_statici18n-2.8.0.tar.gz
| Download URL | django_statici18n-2.8.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b5d99e5e6a2f6ef6c02103eb8751a0182ec7e24d5b7ea823fe41fa088798d30
|
|
BLAKE2b-256 checksum How to use checksums |
332dc5e7450c5f9569f08b4ce48ffea5c6d2120649c57f0c3bf23df16b3984e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / django_statici18n-2.8.0-py2.py3-none-any.whl
| Download URL | django_statici18n-2.8.0-py2.py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e0ceb493d54e784bf58103d2e806df7d26fcdced088c25309c514ffb8f2c6e23
|
|
BLAKE2b-256 checksum How to use checksums |
2d12129f6c0fcc4e45dbce5b409f90006f9d24a8000ca78886a735be630cd62a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for django-statici18n 2.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.