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:
# mix.exs
{:dialecto_in_context, "~> 0.1", only: :dev}
# lib/my_app_web/gettext.ex, after `use Gettext.Backend, …`
if Code.ensure_loaded?(DialectoInContext.Gettext), do: @before_compile(DialectoInContext.Gettext)
# lib/my_app_web/endpoint.ex, before the router
if Code.ensure_loaded?(DialectoInContext.Plug), do: plug(DialectoInContext.Plug)DialectoInContext.Gettext marks every translation while the editor is
open; DialectoInContext.Plug loads the editor's overlay into the app's
pages and answers it on /__dialecto/*. Settings: DialectoInContext.Config.
Summary
Functions
Runs fun with live-site markers off (spec-0025 §4 step 3). A mail rendered
inline while an editor's page is rendering must go through this, or the
editor's markers would reach the recipient
The add-on's version, reported to the sidebar.
Functions
@spec unmarked((-> result)) :: result when result: term()
Runs fun with live-site markers off (spec-0025 §4 step 3). A mail rendered
inline while an editor's page is rendering must go through this, or the
editor's markers would reach the recipient:
DialectoInContext.unmarked(fn -> MyApp.Mailer.deliver(welcome_email(user)) end)
@spec version() :: String.t()
The add-on's version, reported to the sidebar.