Skip to content

PhoenixKit 2.32.0: Media titles and alt text in every language

PhoenixKit 2.32.0 lets each media file have its own title, alt text and description in every language, and puts the alt text on the site’s pages. It also closes several gaps found in a weekly review.

Text per language

A file now has a title, an Alt text (new, images only) and a description for each language. No language is the master copy, so changing the primary language converts nothing: a field shows the requested language, then the primary one, then any.

The media detail page and the viewer sidebar edit the text in the language the admin is shown in. Switch the admin to Estonian and the saved text is the Estonian one. On a multi-language site a small badge names the language being edited, and the primary-language text appears as a placeholder in empty fields, so an untouched save stores nothing. Titles and descriptions saved earlier are read as primary-language text.

Alt text on pages

Images rendered from Storage now use the file’s own alt text in the page’s language when the template sets none. alt="" still marks a decorative image. The media grid and pickers use it too, and the file info API returns title, alt and description.

Fixes from the review

  • A broken host file reference no longer makes orphan cleanup delete the host’s files; cleanup stops and logs an error instead.
  • A Telegram group is never linked on its own. Groups found by a test are listed with a Link button for the owner to confirm.
  • A burst of parallel sign-in attempts can no longer get past the login rate limit, and the failed sign-in alert is sent once.
  • The settings history no longer records values of keys whose name marks them secret, such as …_api_key or …_token.
  • Saving a title no longer undoes a rotation saved in between, and the other way round.
  • An image can be edited again after any number of reverts, and trashing a folder no longer hides files in another trashed folder.
  • mix phoenix_kit.update no longer adds a second default: Oban queue.

Upgrading

Run mix phoenix_kit.update for migrations V198 and V199. V199 adds a data column to the files table. V198 hides secret values already recorded in the settings history and cannot be undone. <.image_set> now looks up the file’s alt text by default; a template that relied on the old empty default to mean decorative should write alt="".

Full release notes: PhoenixKit 2.32.0

2.32.0 · 19 September 2026

Migrations: V198 (data only), V199 (phoenix_kit_files.data) — run mix phoenix_kit.update.

Added

  • Media files can carry a title, alt text and description per language. V199 adds a data column to phoenix_kit_files; a file also gains an alt text, which it never had. Every language holds its own text and none is marked as primary, so changing the site’s primary language converts nothing: each field resolves when it is read — the language asked for, then the current primary language, then any. PhoenixKit.Modules.Storage.FileDetails is the one read and write path: Storage.translated_title/3, translated_alt/3 ("" when there is none — never the file name) and translated_description/3; Storage.update_file_details/3 re-reads the row and replaces one language’s text only, so another language, a rotation or a tag saved in the meantime survives. The metadata title and description of a file saved earlier are read as its primary-language text — no backfill. Plan: dev_docs/plans/2026-09-19-media-translations.md.

  • The media editors edit that text in the language the page is shown in. The admin language switcher is the content switcher: open /et/admin/media/:uuid (or the viewer sidebar on an Estonian page) and the title, alt text and description you save are the Estonian ones. No tabs. A small badge names the language being edited on a multi-language site, and the primary-language text shows as each empty field’s placeholder — never as its value, so an untouched save stores nothing. Both editors — the detail page and the viewer sidebar — now save through Storage.update_file_details/3, and both gained the Alt text field (images only). The viewer reads the language from the page’s own Gettext locale, so hosts embedding it pass nothing new. Eight new strings, translated in all seven locales.

  • The alt text reaches the pages. <.image_set> and the page-builder Image component render a Storage file’s own alt text, in the language the page is rendered in, when no alt is written on them — alt="" still marks a decorative image, and <.image_set> with pre-loaded variants looks nothing up (pass alt; Storage.translated_alts/3 reads it for a whole list in one query, translated_alt_by_uuid/3 for one). System-managed files are never read. GET /api/files/:uuid/info returns title, alt and description, in the language an optional ?locale= names — never the session’s. The MediaBrowser grid and both media pickers use the alt text on their thumbnails, keeping the file name where a file has none.

  • PhoenixKit.Utils.Multilang.current_locale/0 — the language the page being rendered is in, as the full dialect the request resolved to (Languages.request_locale/0, recorded wherever the Gettext locale is set), else the Gettext locale. For per-language content: Gettext’s own locale is downgraded to a base code and cannot tell en-GB from en-US. Readable from a LiveComponent, which has no @current_locale.

  • Storage.update_file_metadata/2 — changes a file’s metadata from the row as it is now, held FOR UPDATE. Both rotation writes use it.

Changed

  • <.image_set>‘s alt now defaults to nil (look the file’s alt text up) instead of "". A caller that relied on the default to mean “decorative” should write alt="".

Fixed

  • Saving a title on the media detail page or in the viewer sidebar no longer overwrites the rest of the file’s metadata with the copy the page loaded earlier — a rotation saved in between was lost. The reverse is fixed too: rotating an image (viewer or grid menu) no longer writes back the metadata it read, so a title or tags saved in between survive, and two quick rotate clicks add up.

The rest are fixes from the 2026-09-19 weekly review (dev_docs/pull_requests/2026/weekly-2026-09-19/CLAUDE_REVIEW.md):

  • A broken host file-reference source no longer makes orphan cleanup delete the host’s files. A :file_reference_sources entry whose function raised, whose table was missing, or that was malformed was skipped with a warning — which dropped that source’s NOT EXISTS guard, so every file only the host referenced read as an orphan and lost its row and its bytes. A source that cannot be built now fails closed: a Logger.error/1 names it and no file is treated as orphaned until it is fixed. The shorthand’s table is looked up through the search path, the way the query itself resolves it.
  • A Telegram group is never linked on its own. A bot’s username is public and anyone can add it to a group of theirs and run /start@bot, so in “Only me” mode the next Test linked a stranger’s group and delivered the owner’s notifications to it. ChatLink now hands captured groups back as candidates, held in the LiveView and never stored; the card lists them with a “Link” button and the owner confirms the ones they recognise. Three new strings, translated in all eight locales.
  • A parallel burst no longer bypasses the login rate limiter. 2.31.0 made the check read the bucket and count the attempt only after the password verify, so every request in a burst saw an empty bucket. The check takes its slot atomically again, and a successful sign-in hands it back (RateLimiter.record_successful_login/2) — so ordinary sign-ins still never lock an account out. The IP bucket is checked first: a client refused for its network no longer spends the slots of the account it names. record_failed_login/2 is deprecated and does nothing.
  • Requests the rate limiter refuses can no longer grow phoenix_kit_login_attempts without bound. A refused request naming no account is stored under "*" — one row per network per hour — instead of one row per invented identifier.
  • The failed sign-in alert is sent once under a parallel burst. The cooldown stamp is a compare-and-set in one statement; concurrent failures that all read “due” from a stale struct no longer each send a mail. The stamp also stopped bumping the account’s updated_at and broadcasting user_updated.
  • V196 no longer aborts on a Google address longer than 160 characters. The backfill copied provider_email (varchar(255)) into google_email (varchar(160)) verbatim; it now skips an address that does not fit and stores the rest trimmed and lower-cased, as the changeset does.
  • An image can be edited after any number of reverts. A revert handed the backup’s unedited_… keys back to the file and the next edit prefixed them again — 42 characters per cycle, until the key outgrew varchar(255) and the file could never be edited again. The prefix is replaced, not stacked.
  • A publish that raises no longer leaves the render and the private unedited copies in the bucket under keys no row points at, a fresh set per retry.
  • Trashing a folder no longer moves a file into a folder that is itself in the trash, where it stayed active, appeared in no trash listing, and was hard-deleted when that folder was emptied. It goes to the trash with its home and comes back with it. A permanent delete that has only a trashed folder to move the file to trashes it with that folder.
  • The settings history withholds secret-named keys, not only the restricted list. A module’s …_api_key or …_token written through the ordinary writers was withheld from the change broadcast and then recorded in plain text in a permanent setting.changed entry. The history now applies the same name test as Settings.Events.secret_key?/2, and V198 withholds the values already recorded. Data only; down/1 restores nothing, by design.
  • Translations follow a recompile. The compile-time Gettext catalogue was cached in :persistent_term under a key that outlived the module, so an edited .po kept serving the old strings until the VM restarted. The cached term now carries the hash of the binary it was decoded from.
  • mix phoenix_kit.update no longer adds a second default: queue. A queue whose limit is not a literal (String.to_integer(System.get_env(…)), a module attribute), or that shares a line with another, read as missing; the duplicate key parsed, and Oban then refused to boot. queues: false written on the config line itself is recognised as a web-only node.
  • mix phoenix_kit.gen.migration (and update --no-start) no longer writes a down that tears PhoenixKit down to the chain’s floor. The install migration’s filename carries no version and scans as 1; when that guess is the starting version the generated down raises and says how to roll back on purpose.
  • MediaBrowser, controlled mode: nav params with no :file key leave the viewer alone — a host wired by hand before file existed had the viewer close on the echo of the click that opened it — and the echo of a superseded step (held ArrowRight) no longer drags the viewer backwards. The moduledoc now documents the key.
  • The folder sidebar opens when the server opens it. The chevron’s client-side class change is sticky in LiveView and was re-applied over the server’s render, leaving the sidebar collapsed after “New folder” and the UI inverted against the saved preference. FolderExplorer takes a sidebar_rev the host bumps on a server-side change.
  • Image editor: the frame keeps an EXIF-turned source’s aspect after a save, retry or revert, and a number field emptied mid-edit keeps its crop or area instead of deleting it and renumbering the ones below under the cursor.
  • The media viewer’s title/description editor and rotation save honour the browser’s scope. MediaCanvasViewer takes a write_scope; a file merely linked into a scoped browser is no longer retitled or rotated for its owner.

PhoenixKit 2.32.0. Install or update: {:phoenix_kit, "~> 2.32"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.