Inline translation string editing for Django
Project description
django-cartouche
Inline .po translation editing for Django. Click on any translated string in the browser to edit it directly during development.
Installation
Install as a development dependency:
pip install django-cartouche --group dev
# or with uv
uv add django-cartouche --dev
Configuration
django-cartouche should only be installed in development environments. Configure it in your local/development settings file (e.g., settings/local.py or settings/dev.py):
# settings/local.py
from .base import *
DEBUG = True
INSTALLED_APPS += [
"cartouche",
]
MIDDLEWARE += [
"cartouche.middleware.CartoucheMiddleware", # Must be after LocaleMiddleware
]
Conditionally include URLs in your urls.py:
from django.conf import settings
urlpatterns = [
# ...
]
if settings.DEBUG:
urlpatterns += [
path("cartouche/", include("cartouche.urls")),
]
Set the lang attribute on your <html> element for locale detection:
<html lang="{{ LANGUAGE_CODE }}">
The editor only activates when DEBUG=True, but following these practices ensures cartouche is never present in production.
Development
uv sync # Install dependencies
uv run pre-commit install # Install git hooks (one-time)
cd demo && python manage.py runserver # Run demo server
ruff check src/ && ruff format src/ # Lint and format
pytest --cov # Run tests with coverage
Making Commits
Use the interactive CLI for guided conventional commits:
uv run cz commit
Or use standard git with conventional format:
git commit -m "feat: add new feature"
git commit -m "fix(compiler): handle edge case"
Feedback
If you end up using django-cartouche, I'd genuinely like to hear about your experience. Whether you've found it helpful, run into issues or have ideas for improvements, your feedback is welcome.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_cartouche-0.2.0.tar.gz.
File metadata
- Download URL: django_cartouche-0.2.0.tar.gz
- Upload date:
- Size: 77.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1365f230606390c392be5467ecccc041f0c1a73f8bb9432fa0eee9879e02d034
|
|
| MD5 |
cb3b80f446a1ceae2758aa7aec670491
|
|
| BLAKE2b-256 |
c5a0406c00b7d67c90055398216907f2eca2848e5a00149798dd2b41ccdde3b5
|
Provenance
The following attestation bundles were made for django_cartouche-0.2.0.tar.gz:
Publisher:
release.yml on rnegron/django-cartouche
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_cartouche-0.2.0.tar.gz -
Subject digest:
1365f230606390c392be5467ecccc041f0c1a73f8bb9432fa0eee9879e02d034 - Sigstore transparency entry: 779870825
- Sigstore integration time:
-
Permalink:
rnegron/django-cartouche@165c74f06ecd0a4c24c816176d4cbc510ae7d578 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rnegron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@165c74f06ecd0a4c24c816176d4cbc510ae7d578 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_cartouche-0.2.0-py3-none-any.whl.
File metadata
- Download URL: django_cartouche-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3c134361cdbd2da6f29c5d1f4b22ae46c4cc81a92ecdb7cc67aa847e0475067
|
|
| MD5 |
eeca23ec2b2070d3b922f8fa5b8f878f
|
|
| BLAKE2b-256 |
97f5f57140cc8a6af42a1a02ad23c0ca1982796e6ab9a3734ccae52d0e16c47f
|
Provenance
The following attestation bundles were made for django_cartouche-0.2.0-py3-none-any.whl:
Publisher:
release.yml on rnegron/django-cartouche
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_cartouche-0.2.0-py3-none-any.whl -
Subject digest:
d3c134361cdbd2da6f29c5d1f4b22ae46c4cc81a92ecdb7cc67aa847e0475067 - Sigstore transparency entry: 779870827
- Sigstore integration time:
-
Permalink:
rnegron/django-cartouche@165c74f06ecd0a4c24c816176d4cbc510ae7d578 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rnegron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@165c74f06ecd0a4c24c816176d4cbc510ae7d578 -
Trigger Event:
push
-
Statement type: