Skip to content

Projects 0.5.0: AI translation for projects, templates and tasks

Projects 0.5.0 adds AI translation to the module’s forms. An AI Translate button on the project, template and task forms translates names and descriptions into the site’s other languages in the background. Templates become translatable, and project progress now counts partly finished tasks.

AI translation

The button sits above the language tabs on the project, template and library task edit forms, and shows how many languages are missing. It opens an AI Translation dialog where you pick an AI endpoint and a prompt (or create a default prompt), then choose what to translate: only the missing languages, all other languages (overwriting what is there), or only the current tab. The button is hidden when the AI module is not available, and on forms for new records.

The work runs as a background job, and the form updates as each language finishes. Only the translations are filled in, so unsaved changes on the form survive. A translation that fails for a reason that will not go away is dropped rather than retried, so it does not keep spending tokens, and the same translation cannot be queued twice while one is running.

Translatable templates and partial progress

The template form gets the same language tabs and translatable name and description that projects already had. A project’s overall progress is now the average of each task’s progress, instead of counting only finished tasks. A project still completes only when every task is done.

Fixes

  • An embedded project page crashed when its comments drawer was opened.
  • Forms opened in the popup were held to a narrow width inside it. They now fill the popup, and an app can set the popup’s width with the modal_box_class session key.

Upgrading

Projects 0.5 needs PhoenixKit 1.7.117 or later, which carries the translation helper the job uses. Update core first. No migration. To use AI translation, set up the AI module with an endpoint.

Full release notes: Projects 0.5.0

0.5.0 · 21 May 2026

AI-driven translation for projects, templates, and tasks — an Oban-backed worker plus an in-form translate UI — alongside a batch of field-report fixes (embedded-mount crash, partial-progress rollup, translatable templates, popup width).

Added

  • AI translation — PhoenixKitProjects.Translations public API (enqueue/1, enqueue_all_missing/2, AI endpoint/prompt resolution, and default-prompt provisioning) backed by PhoenixKitProjects.Workers.TranslateResourceWorker, an Oban worker that translates Project / Template / Task / Assignment translatable fields via the shared translation helper. Deterministic failures discard instead of retrying (no token burn), and failure reasons are sanitized before logging / activity-metadata writes.
  • <.ai_translate_bar> + AI Translation modal on the project / template / task form LVs — a compact trigger above the multilang tabs with endpoint/prompt selectors and a scope picker (missing-only / all-overwrite / current tab). Hidden when AI is unavailable or on :new. Status streams over scoped per-resource PubSub; completion patches only the translations field of the live changeset, so unsaved edits survive a job finishing mid-edit.
  • Translatable templates — TemplateFormLive gains the multilang plumbing (tabs, language switcher, translatable name + description) already present on projects.
  • Partial-progress rollup — overall project progress now averages each assignment’s progress_pct instead of counting only done. Project auto-completion stays binary (flips to :completed only when every assignment is done).
  • Projects.get_projects/1 — batch %{uuid => Project} lookup so host list views can avoid a per-row N+1.
  • session["modal_box_class"] — PopupHostLive accepts a host-supplied modal-box width (default w-11/12 max-w-6xl).

Changed

  • Minimum phoenix_kit is now ~> 1.7.117 — it ships the shared translation parser/helper that the translation worker delegates to.
  • Popup child frames now fill the modal box — PopupHostLive injects a full-width wrapper_class unless the host passes its own, fixing form LVs that stacked their standalone max-w-xl cap inside the popup.

Fixed

  • Embedded ProjectShowLive comments-drawer crash — switched bang-form @phoenix_kit_current_scope to bracket access, so off-router live_render mounts (which skip core’s on_mount) no longer raise KeyError when the drawer opens.
  • AI unique-job window — TranslateResourceWorker now sets unique: [period: :infinity, …]. The omitted period defaulted to 60s, which let a translation slower than a minute be enqueued a second time and burn tokens twice.
  • AI overwrite vs. open form — the “all”/overwrite scope now overwrites translations in the open form too (mirroring the worker’s persisted merge) instead of leaving stale values that a save would silently revert; missing/current scopes keep the blank-only edit protection.
  • AI mount cost + flash accuracy — the five Settings/plugin lookups now run only on the connected mount (mount/3 fires twice), and an empty-source completion flashes an accurate message instead of “Translated”.

Tests

  • New translations_test.exs + translate_resource_worker_test.exs (argument validation, deterministic-failure discard, broadcast fan-out, merge + source-lang semantics, overwrite-flag propagation), ai_translate_form_helpers_test.exs + ai_translate_bar_test.exs (missing-language detection, merge policy, scope/visibility), and an embedding_test.exs regression that greps lib/ for any @phoenix_kit_* bang-form reference.

Projects 0.5.0. Install or update: {:phoenix_kit_projects, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.