Skip to content

Add internationalization (i18n) support #593

Description

@bpepple

Context

Metron is starting to see international users. This issue tracks the work to make the codebase translation-ready, in phases rather than one large change.

Decisions:

  • Language switching: cookie/session-based via Django's built-in set_language view + LocaleMiddleware. No URL prefixing (i18n_patterns) — URLs stay as they are.
  • Translation workflow: a community platform (Weblate/Transifex/Crowdin style) where volunteer translators edit .po files via a web UI, synced back via PR.
  • Pilot language: Italian.
  • Rollout: infra + a pilot slice first to prove the pipeline end-to-end, then roll out to the rest of the app in batches by app.

Phase 0 — Infrastructure

  • LANGUAGES / LOCALE_PATHS settings, LocaleMiddleware, i18n context processor
  • set_language URL + language switcher UI in the navbar
  • locale/ directory layout (single project-level catalog, not per-app)

Phase 1 — Pilot slice (base.html/navbar/footer/messages + Issue model/form/view)

  • Mark up global templates (base, navbar, footer, messages partial)
  • Mark up Issue model verbose_names
  • Mark up Issue form labels/help_text/ValidationError
  • Convert Issue view messages.*() calls (f-string → %(name)s-style)
  • Generate + translate pilot .po catalog, verify end-to-end via dev server
  • Containerfile: compile catalogs at image build time
  • CI: catalog compile-check step

Phase 2+ — Rollout by app (smallest first)

  • timeline, api (incl. 6 DRF serializer ValidationErrors)
  • polls, pull_list
  • wish_list, user_collection
  • users (incl. account activation email)
  • reading_lists
  • Remaining global templates/ (error pages, widget overrides)
  • comicsdb remainder (models, forms, views, all 58 templates, statistics.py strftime fixes)
  • api throttle notice/enforcement email templates (pluralization restructuring — hardest, deferred deliberately)

Tooling / workflow

  • Set up a Weblate-style community translation platform pointed at locale/*/LC_MESSAGES/django.po
  • PR template reminder for wrapping new user-facing strings

Status

Phase 0, 1, and 2 (full rollout across all apps and templates) are implemented locally and verified end-to-end — full test suite (1719 passed, 2 pre-existing skips), ruff clean, makemigrations --check clean, Italian .po catalog fully translated (0 fuzzy, 0 untranslated) and compiled. Added .github/pull_request_template.md with a checklist reminder to wrap new user-facing strings and run makemessages -a. Remaining work is setting up a community translation platform (Weblate-style), which is external tooling/account setup rather than a code change.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions