viewflow/seedkit / skills/django-seedkit
django-seedkit
FlaggedBootstrap a new Django project, or add components — auth (allauth, magic-link, axes, 2FA), payments (Stripe, dj-stripe), REST (django-modern-rest, django-bolt), Celery / Django Tasks, async views & WebSockets (ASGI, uvicorn worker, django-channels, channels-redis), Tailwind+DaisyUI, favicon, SEO meta tags + sitemap, HTML email templates, S3 storage, structlog, healthchecks, Docker, CI, deploy (VPS / Fly / GitHub-SSH), dbbackup, Sentry/Bugsink — to an existing Django codebase. Use whenever the user wants to scaffold Django, integrate a Django package, set up async / WebSockets, set up production deploys, wire CI/CD, or extend an existing Django project.
references/i18n.md
View on GitHub# Internationalisation (i18n)
Docs: <https://docs.djangoproject.com/en/6.1/topics/i18n/translation/>
Django ships the i18n machinery. The bits a starter usually misses: `LOCALE_PATHS`, `LANGUAGES`, `LocaleMiddleware`, the locale-aware URL include, and a `makemessages` / `compilemessages` workflow.
Skip if the project will only ever speak one language. Adding it later costs real work — every existing template string needs `{% trans %}` and every Python user-facing string needs `gettext_lazy`.
## Settings
```python
from django.utils.translation import gettext_lazy as _
LANGUAGE_CODE = "en"
USE_I18N = True
USE_TZ = True
LANGUAGES = [
("en", _("English")),
("de", _("German")), # add the languages you intend to ship
]
LOCALE_PATHS = [BASE_DIR / "locale"]
```
`USE_L10N` is gone in Django 5+ — formats follow `LANGUAGE_CODE` automatically.
## Middleware
`LocaleMiddleware` reads the user's language from the URL prefix (when `i18n_patterns` is in use) / cookie / `Accept-Language` header, in that order. Insert immediately before `CommonMiddleware`:
```python
common_idx = MIDDLEWARE.index("django.middleware.common.CommonMiddleware")
MIDDLEWARE.insert(common_idx, "django.middleware.locale.LocaleMiddleware")
```
## URLs — language prefix (optional)
Pick **one** of two patterns:
**A. No prefix.** Language is detected from header / cookie. URLs stay `/admin/`, `/foo/`. Simplest.
**B. Language prefix.** URLs become `/en/admin/`, `/de/admin/`. Better for SEO, link-shareable.
```python
from django.conf.urls.i18n import i18n_patterns
from django.urls import include, path
urlpatterns = [
path("i18n/", include("django.conf.urls.i18n")), # the set_language POST view
*i18n_patterns(
path("admin/", admin.site.urls),
# other prefixed patterns here
prefix_default_language=False,
),
]
```
`prefix_default_language=False` keeps the default-language URLs unprefixed (`/admin/` instead of `/en/admin/`).
## Templates
```django
{% load i18n %}
<title>{% trans "Sign in" %}</title>
<p>{% blocktrans with email=user.email %}Hello, {{ email }}{% endblocktrans %}</p>
```
Switch language form (works because of `i18n/` URL include above):
```django
<form action="{% url 'set_language' %}" method="post">
{% csrf_token %}
<select name="language" onchange="this.form.submit()">
{% get_current_language as cur %}
{% get_available_languages as langs %}
{% for code, name in langs %}
<option value="{{ code }}" {% if code == cur %}selected{% endif %}>{{ name }}</option>
{% endfor %}
</select>
</form>
```
## Workflow
Generate / update `.po` files for each language:
```sh
uv run manage.py makemessages -l de -l fr
```
Edit `locale/<lang>/LC_MESSAGES/django.po`. Compile:
```sh
uv run manage.py compilemessages
```
Both commands shell out to GNU gettext (`msgfmt` / `xgettext`) — install it on the dev host first (`brew install gettext` / `apt-get install gettext`). In the container dev loop the commands run inside `web`, so the `dev` stage needs the same `apt-get install -y --no-install-recommends gettext` line the builder stage carries below.
Commit `.po` files. Don't commit `.mo` files (compile at deploy / Docker build time):
```
# add to .gitignore
*.mo
```
In the production Dockerfile, add to the **builder** stage (the compiled `.mo` files reach the runtime stage via `COPY --from=builder /app /app`; no slim image ships `msgfmt`):
```dockerfile
RUN apt-get update && apt-get install -y --no-install-recommends gettext \
&& rm -rf /var/lib/apt/lists/*
```
and after `COPY . .`:
```dockerfile
RUN DJANGO_SETTINGS_MODULE=config.settings.production DJANGO_DEBUG=True \
/opt/venv/bin/python manage.py compilemessages
```
## Pragmatics
- `gettext_lazy` (alias `_`) for module-level strings — they're evaluated at import, before any request, so eager `gettext` would freeze them in the server's default language.
- `gettext` (alias `_` — note: same name; use one or the other consistently) inside view bodies and request-scoped code.
- JavaScript translations: `JavaScriptCatalog` view. Skip until you actually need translated client-side strings.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |