Added
-
Optional erlydtl template bridge (
erli18n_erlydtl). A new optional
module lets an erlydtl template translate
its{% trans %}/{% blocktrans %}tags through erli18n — full gettext
(contexts, CLDR plurals, hot-reloadablepersistent_termcatalogs, per-request
locale), with erlydtl keeping ownership of{{ var }}interpolation and
auto-escaping.erli18n_erlydtl:translation_fun/1returns a render-timetranslation_fun(a
fun/2) bound to a gettext domain; pass it in erlydtl'srender/2options. The
tag mapping — performed by the pure, exporteddecode/2— is{% trans %}→
gettext,context→pgettext, a counted{% blocktrans %}→ngettext,
andcontext+ count →npgettext. The locale comes from an explicit
binary/stringlocalerender option, or falls back to the per-process locale
(erli18n:which_locale/0) thaterli18n_cowboy/erli18n_ellialready set —
so it composes with the request middleware with no extra wiring.Unlike the Cowboy/Elli adapters, the bridge is an inverted integration: it
references zero erlydtl functions (erlydtl calls into the fun), so it is
not anoptional_applicationsentry and carries no
xref/dialyzer/eqwalizer suppressions — full static analysis stays live over
every line. The fun is total overterm(): a non-integercount(a missing
template variable) and a non-chardata runtime_(Var)value are normalized
rather than crashing the render. On a miss it echoes the msgid — matching
erlydtl's own source fallback for{% trans %}, and giving a count-appropriate
two-form fallback for a counted{% blocktrans %}(a deliberate improvement on
erlydtl's singular-only native fallback).erlydtlis a test-profile
dependency only; the published package still requires onlykernel+stdlib.A runnable example lives in
examples/erli18n_erlydtl_demo.