PhoenixKit 2.16.0: Emails and notifications in the recipient's language
PhoenixKit 2.16.0 sends account emails and notifications in the language of the person receiving them, lets a site override email texts with files in its own repository, and keeps a permanent history of every settings change.
Emails in the recipient’s language
Every account email had gone out in English, even where the email template was translated. The language now comes from the recipient: the language they picked in the language switcher, then the site’s content language, then English. This covers confirmation, password reset, email change, magic link, organization invitation and new-login emails.
On a site with no email templates in the database, the wording of these emails changes: they used to be fixed English texts and are now PhoenixKit’s own translated texts. A site that has its own templates in the database sees no change, because those still win.
Notification texts, in the inbox, Telegram and the email channel, are translated too. 38 new texts come translated into all seven languages.
Email texts as files
A site can now override any part of an account email with a file under priv/phoenix_kit_templates/<template name>/ in its own app, for example new_login_alert/text.txt, or text.de.txt for German only. The most specific file wins, and each part (subject, text, HTML) is looked up on its own. The folders can be changed with config :phoenix_kit, template_paths:.
The new-login alert now has a link to the account settings, where it used to ask the reader to change their password without one. The new-login alert and magic-link registration emails, and the organization invitation, now have templates of their own instead of a fixed English text.
A history of settings changes
Every change to a site setting is now written to the activity feed as a permanent entry: who changed it, from which value to which, and when. Saves in the admin settings pages record the admin who made them. Secret settings record that a change happened, without the values. Permanent entries are never removed by the activity clean-up. A batch save of settings could deadlock against another one; that is fixed.
Smaller changes
- The Modules page no longer offers
phoenix_kit_templatesfor install, since it comes with core. - A blank time zone on a user now falls back to the site’s time zone instead of UTC.
- Posts store the time zone they were scheduled in.
Upgrading
Run mix deps.get (core now depends on phoenix_kit_templates) and mix phoenix_kit.update. The migrations move from V183 to V186. They remove the unused shop_currency setting, and add base currency and exchange rate columns to carts, cart items and orders, filled in from your currencies table. That migration stops with an error unless exactly one currency is marked as the default, so check the currencies first.
Full release notes: PhoenixKit 2.16.0
2.16.0 · 6 September 2026
Added
-
Outbound messages are rendered in the recipient’s language. Every auth email had been going out in English no matter who received it. Five call sites in
UserNotifierand one inMailerused the two-arityrender_template/2, whose locale defaults to"en"— so a template translated into all seven locales was only ever read in one of them, and the translations sat in the database unread. OnlyMailer.send_from_template/4passed a locale.PhoenixKit.Utils.RecipientLocaleis now the single answer to “whose language is this message in”:for_rendering/1returns the recipient’s full dialect and nevernil, falling back to the site content language and then"en";base/1returns the base code ornilfor Gettext, which readsnilas “leave the current locale alone”. It keeps the dialect rather than narrowing it, since template resolution tries"en-GB"before"en"and pre-truncating would discard a dialect-specific translation. The preference comes fromcustom_fields["preferred_locale"], written by the language switcher. -
Message templates can be customized by the host, as files.
PhoenixKit.Email.Contentresolves every auth email across three layers: an active database template (unchanged, and still winning — see below), then a host override file for the recipient’s locale, then core’s own translated default. Parts resolve independently, so a host that overrides only the body keeps core’s translated subject.An override is a file in the host’s own repo, version-controlled and reviewable. The template’s name is a directory; the files inside it are named for the part they supply:
<host>/priv/phoenix_kit_templates/ └── new_login_alert/ ├── text.txt # <part>.<ext> └── text.de.txt # <part>.<locale>.<ext>Lookup runs most- to least-specific —
text.de-AT.txt→text.de.txt→text.txt→ core’s default — so a single-language host writes one file and is done. Roots come fromconfig :phoenix_kit, template_paths:, defaulting to the host application’spriv/phoenix_kit_templates. -
New dependency:
phoenix_kit_templates. A leaf package with no runtime dependencies of its own, which is what lets core depend on it rather than feature-detect it through a behaviour.mix deps.getafter upgrading. -
The new-login alert finally carries a link. It had been telling readers to change their password immediately while giving them nothing to click — on the one email that reaches a genuinely compromised account.
-
Three templates that were looked up but never existed.
new_login_alertandmagic_link_registrationwere both resolved by name and had no seeded template, so they always fell through to a hardcoded English string. Both now exist, as doesorganization_invitation, which had never been templated at all.
Changed
-
⚠️ Auth email wording changes for hosts with no database template. Those installs were receiving the hardcoded English fallbacks; they now receive core’s Gettext defaults in the recipient’s language. This is the point of the release, but it is visible — someone will notice their confirmation email reads differently. Hosts with customized database templates see nothing change: that layer still wins, deliberately, and will keep winning until an export task ships and operators have moved their edits to files. Removing it now would silently revert every customized message.
-
Notification text is translated.
Notifications.Renderheld 21 hardcoded English literals — the text of every notification reaching the inbox, Telegram, the email channel and any future push.Channel‘s own moduledoc had named the hole: the envelope carried:locale“but the core’s built-in rendering is English today”. It no longer is.render/2installs the recipient’s locale for the lookup; anillocale still means “leave the current locale alone”, which is what the admin inbox wants — it renders in the viewer’s language, not a recipient’s.Three strings that concatenated a detail onto a translated stem (“Your email was changed” + “ to x”) became two complete msgids each. A suffix cannot be reordered, and several languages need the detail somewhere other than the end.
-
38 new msgids, translated into all seven locales. Five of them arrived from
gettext.mergecarrying a translation matched from a different msgid —"New notification."had inherited the translation of “My notifications” in every locale, and"Confirm your account"had inherited “Confirm my account”. Gettext compiles and serves fuzzy entries, so all five were rewritten by hand.
Fixed
-
Batch settings writes could deadlock. The settings history added in this release reads each key
FOR UPDATEinside the write’s transaction, and the batch path took those locks inEnum.reduceorder over a map. Erlang map iteration is not a stable total order — a map of 32 keys or fewer is a flatmap iterated in term order, a larger one is a hashmap iterated in hash order, and the same two keys come out reversed between them. Two concurrentupdate_settings_batch/2calls sharing keys, one small and one large, would take them in opposite orders and deadlock. Keys are now sorted before the reduce, so every batch acquires in the same order whatever its size. -
ModuleRegistry.not_installed_packages/0advertised an installed package. It derived “installed” from module discovery alone, which only finds packages implementing thePhoenixKit.Modulebehaviour — so an infrastructure dependency that implements none looked absent, and the admin Modules page would have offeredphoenix_kit_templatesas available to install while it was already a transitive dependency of core. It now also consults loaded applications; neither check subsumes the other. -
The notification delivery and digest workers each carried their own identical private copy of the recipient-locale resolution, and a third was about to be written. All three now share one.
PhoenixKit 2.16.0. Install or update: {:phoenix_kit, "~> 2.16"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.