E-commerce 0.5.5: A translations page for products and categories
E-commerce 0.5.5 turns AI translation of the shop’s products from a per-product button into a managed job, with a new Translations page, category translation and an optional background sweep.
The page counts, per language, which translations are fresh, stale, missing or unknown, with filters and bulk actions such as Translate again, and a Stop translations button. A translation is stale once its source text changes, and a translation edited by hand is never overwritten unless you ask for it. Categories can now be translated too. An optional sweep queues missing and stale translations on its own, a few at a time. Settings also get a switch to turn Shopify sync off, which hides it without touching the stored connection.
Upgrading
Nothing changes until you switch translations on in the shop settings, which needs an AI endpoint and AI 0.20 or later. Existing translations show as unknown at first: run mix phoenix_kit_ecommerce.backfill_translation_fingerprints once, before turning the sweep on. Translation is not available under the catalogue product source.
Full release notes: E-commerce 0.5.5
0.5.5 · 15 September 2026
Added
- Catalogue translation control (
/admin/shop/translations, sidebar entry “Translations”). A new admin page that turns AI translation from a per-product button into a managed operation: per-languagefresh/stale/missing/unknowncounts, filters (type, category, language, state, field, search) that live in the URL, bulk “translate”, “translate again” and “stamp current source as reference” actions behind a confirm modal, a “Run sweep now” / “Stop translations” pair, live status via PubSub, and a recent-failures panel readingphoenix_kit_ai_requests. Gated behindshop.manage_catalog(view) /shop.manage_settings(act), and behind the newshop_translations_enabledsetting — off by default, and the toggle itself stays disabled until an AI endpoint is configured (PhoenixKitAI.Translations.available?/0). - Category translation.
PhoenixKitEcommerce.CategoryAITranslatable(shop_category) translatesnameanddescriptionunder the sameFOR UPDATE-locked merge as the product adapter, with its own prompt (phoenixkit-shop-category-translation) and slug handling — a category slug is generated once, locally, from the translated name viaLocalizedSlug, and never taken from the model. There was no way to translate a category at all before this. - Staleness tracking for both products and categories.
PhoenixKitEcommerce.TranslationFingerprintstores a per-field, per-language SHA-256 of the source text a translation was made from (in the existingmetadataJSONB — no migration) and folds it into one of four states, worst wins:missing>stale>unknown>fresh. The fingerprint is taken from the exact source text the worker sent to the model, not the resource’s state when the write lands seconds later (see the pairedphoenix_kit_aichange below). This is also the write lock:put_translation/4only overwrites a field whose source changed since it was last translated, so a manually-edited translation is never clobbered by a later sweep, re-run, or bulk action — “translate again” now means an explicit reset of the reference for chosen fields/languages, not blind overwrite. - Reconciliation sweep.
PhoenixKitEcommerce.Workers.TranslationSweepWorkeris a self-rescheduling Oban job that periodically findsmissing/stalepairs (one SQL query per resource type, hashing in the database) and enqueues translation jobs for them, respecting a batch size and an in-flight ceiling so it can never fill the shareddefaultqueue.unknownpairs are never auto-queued — the operator disposes of them explicitly from the translations page. Off by default (shop_translation_sweep_enabled); the chain self-heals after a restart or Oban pruning viaensure_scheduled/0, called fromenable_system/0, settings save, and the page’s own mount. - New settings (existence card in
/admin/shop/settings; sweep operation in the panel on the translations page itself):shop_translations_enabled(bool, defaultfalse) andshop_translation_sweep_enabled(bool, defaultfalse) gate the feature and the automatic sweep independently — turning the feature off also turns the sweep off;shop_translation_interval_minutes(default60),shop_translation_batch(default3) andshop_translation_max_in_flight(default6) tune the tick;shop_translation_languages(default: every enabled language but the primary) andshop_translation_statuses(default["active"]) scope it. Every change is written toActivity.logwith its actor. shop_shopify_enabledsetting (bool, defaulttrue— existing stands keep today’s behavior with no action needed). Turning it off hides the Shopify Sync sidebar entry and integrations-page option, redirects a direct link to/admin/shop/shopify-syncback to the shop dashboard, and drops Shopify fromrequired_integrations/0— without touching the stored connection or its token, so re-enabling restores sync exactly as it was.
Changed
pk_dep(:phoenix_kit_ai, ...)floor raised from~> 0.18to~> 0.20. Both new adapters template their entire source section as{{SourceFields}}and rely on the translation worker forwardingopts[:source_fields]intoput_translation/4— both land only in phoenix_kit_ai 0.20.0. An engine below that floor cannot resolve against this release in a way that does anything useful: every prompt would render with an empty source section (§9.1 missing) and, even if it didn’t, no field would ever fingerprint (§9.3 missing), so nothing in the paragraph above would work.phoenix_kit_aistays optional — absent, the whole translation feature (adapters, worker, page, sidebar entry) compiles out and the rest of the shop is unaffected.
Fixed
Post-merge review of PR #56; findings in
dev_docs/pull_requests/2026/56-catalogue-translation-control/CLAUDE_REVIEW.md.
- Translations no longer run against the catalogue product source. Both
adapters work on the shop’s own tables and are not registered with
phoenix_kit_aiundershop_product_source: "catalogue", yet the page listed catalogue items it could not act on and every sweep tick enqueued jobs the translation worker discarded as an unknown resource type. The newPhoenixKitEcommerce.translations_supported?/0now gates the page (redirect with an explanation), the tick (a newproduct_source_unsupportedstop reason, manual run included) and the settings toggle (disabled, and the handler refuses). - The translations page no longer reloads on every AI translation event.
It subscribes to the global topic every module broadcasts on, and each event
re-read the whole catalogue twice plus the prompt rollout and request log.
It now reloads only when a
shop_product/shop_categoryjob completes or fails. - Enabling the shop can no longer crash on sweep scheduling. A failure to
insert the sweep tick (Oban not running yet, an insert refused) is logged
instead of raising out of
enable_system/0aftershop_enabledhas already flipped; the translations page and a sweep-settings save retry it. - The translations page schedules the sweep tick on the connected mount only, not on the dead render as well.
Operator notes
- Nothing changes on upgrade until
shop_translations_enabledis turned on in/admin/shop/settings, which requires an AI endpoint already configured under the AI module. Turning it on does not turn the sweep on — that isshop_translation_sweep_enabled, a separate toggle on the translations page. - Every currently-translated product/category pair on an existing
catalogue comes back as
unknown, notfresh— this release has no record of what source text they were translated from, and the sweep deliberately never auto-queuesunknown(a first tick would otherwise re-translate the entire catalogue). Run the new one-shotmix phoenix_kit_ecommerce.backfill_translation_fingerprints(has a--dry-run) once, before turning the sweep on, to stamp today’s source text as the reference baseline for every existing translation; without it the whole catalogue instead sits inunknownuntil resolved resource by resource from the translations page. Do not run it a second time once the sweep has been live — see the task’s own@moduledocfor why. - Sweep defaults (60-minute interval, batch 3, ceiling 6) are sized
against the shared
defaultOban queue’s own concurrency (10) so a tick always leaves headroom for other background work; raise them together (batch × target languages = ceiling) when clearing a large backlog, and drop them back afterward.
E-commerce 0.5.5. Install or update: {:phoenix_kit_ecommerce, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.