Skip to content

Make the remaining template text translatable (#476) - #1016

Merged
vjpixel merged 1 commit into
developfrom
i476-template-msgids
Oct 18, 2026
Merged

vjpixel merged 1 commit into
developfrom
i476-template-msgids

Conversation

@vjpixel

@vjpixel vjpixel commented Oct 18, 2026

Copy link
Copy Markdown
Member

Follow-up to #1007 and #1013 for #476: some English on the site could not be translated from the catalogs alone, because the templates either built msgids at runtime or did not wrap the text in _().

Changes

  • core/collection.jinja2: the headings and "All …" links used _("Jandig " + element_type.capitalize() + "s") and _("All " + …). pybabel cannot extract those, so the next make translate_* would have marked the catalog entries obsolete. They are now literal msgids in a lookup table keyed by element type (the AR/MR exhibit branches fold into the same table). The msgids are unchanged, so existing translations still apply.
  • core/upload-object.jinja2: the thumbnail preview script wrote "Thumbnail" and "Generate Thumbnail" in English. The strings now come from Jinja via {{ _("…")|tojson }}, and the heading is set with textContent rather than innerHTML.
  • Password reset pages (password_reset, password_reset_confirm, password_reset_complete): the headings, the label, placeholders, buttons, links and the "invalid link" and "password has been set" messages are wrapped in _(). The existing E-mail, Submit and New Password msgids are reused. The "password has been set" sentence keeps its link inside one msgid (%(url)s), so translators see the whole sentence.
  • locale/pt_BR, locale/es_ES: added Brazilian Portuguese and Spanish translations for the 14 new msgids. The collection entries now point at their template lines in place of the "Built at runtime" translator comment. Both catalogs were checked with polib: 0 untranslated, 0 fuzzy, placeholders match.

The draft privacy policy is left untranslated on purpose (pending legal review).

Verification

  • Parsed every changed template with Jinja2 (i18n extension, newstyle gettext, autoescape) and checked that extract_translations finds all the new msgids. Also rendered the lookup table, the tojson output and the %(url)s link.
  • ruff check --extend-select I src/ and ruff format --check src/ pass.
  • The Django tests run in CI (Pipeline RC).

🤖 Generated with Claude Code

- collection.jinja2: replace the msgids built at runtime ("Jandig " +
  element_type + "s", "All " + ...) with literal ones in a lookup table,
  so pybabel extracts them and msgmerge no longer marks them obsolete.
- upload-object.jinja2: pass the "Thumbnail" and "Generate Thumbnail"
  labels to the thumbnail preview script from Jinja.
- Password reset pages: wrap the hardcoded headings, labels,
  placeholders, buttons, links and messages in _(), reusing the
  existing "E-mail", "Submit" and "New Password" msgids.
- pt_BR and es_ES: add translations for the new msgids and point the
  collection entries at their template lines instead of the "Built at
  runtime" translator comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vjpixel
vjpixel merged commit 7bfea02 into develop Oct 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant