Modules
Dialecto's in-context editor for Phoenix apps translated with gettext
(spec-0017). Dev-only: add it as a only: :dev dependency and opt in with
two guarded lines that compile to nothing where the dependency is absent,
so production carries no trace of it
What a marker records about the call that produced its text (spec-0017 §1.1), so the overlay can preview an edit exactly as gettext would render it
The add-on's settings, with the Astro add-on's names (spec-0017 §1).
Environment variables win over config :dialecto_in_context, …
Marks a Gettext backend's translations for the in-context editor
(spec-0017 §1.1). Opt in after use Gettext.Backend, guarded so it compiles
away wherever the dev-only dependency is absent
The site's context for the sidebar (spec-0016 §4, served at
/__dialecto/context): {repo, project, branch, sha, dirty, addon}, read
from git on demand so switching branches needs no restart. A git failure
only leaves its field empty.
Verifies the launch token Dialecto mints for an editor (spec-0025 §3), with no call to Dialecto
The per-request marking flag of live mode (spec-0025 §4 step 3).
The plug's :live half (spec-0025 §4): inert for visitors, on only for an
editor who arrived with a launch link.
Live-site marking for LiveViews. A LiveView runs in its own process, which
the plug's flag never reaches, so add the hook to the app's live_sessions
The in-context marker codec v1 (spec-0016 §3), byte-identical to the
overlay's codec.js and the Astro add-on's encoder.
The saved-drafts payload the overlay posts to /__dialecto/overrides
(spec-0017 §1.2): {edits: [{domain, key, locale, to}]}, where a plural
entry carries forms: [msgstr0, msgstr1, …] instead of (or beside) to.
The set replaces the previous one; an empty list restores the catalogs.
The dev server's side of the in-context editor (spec-0017 §1.4). Put it in
the endpoint before the router (and before Plug.Parsers, so it reads its
own small JSON bodies)
The dev server's in-context state, in a protected ETS table this process owns: whether marking is on (spec-0017 §1.3) and the saved drafts the overlay sent (§1.2). Every gettext lookup reads it, so reads go straight to ETS; writes are serialized through the process.
Mix Tasks
Refreshes the copy of Dialecto's overlay that live mode serves from the
site's own origin (priv/static/overlay.js). For maintainers of this
package: build the overlay in the Dialecto repository first
(mix esbuild in_context), then run