API Reference verified_translations v#0.1.1

Copy Markdown View Source

Modules

Compile-time verified translations for Phoenix.

Gettext's translation macros, compiled to verified JSON translations.

on_mount hook setting the LiveView process locale from the "locale" param or session (see VerifiedTranslations.Plug)

One translation file: <path>/<domain>/<slug>-<hash>.json holding the source text ("msgid") and one key per locale.

Sets the locale from ?locale=fi, falling back to the session.

CLDR plural rules, compiled from the bundled priv/cldr/plurals.json (cardinal: 1 file, 2 files) and priv/cldr/ordinals.json (ordinal: 1st, 2nd), CLDR 49, Unicode License v3.

Mix Tasks

Recompiles the project with verification disabled, so every ~t creates its missing translation file in one go (and adds keys for newly configured locales), then lists the files that still lack a locale.

Imports translated messages from Gettext PO files into priv/translations/<domain>/*.json.

Installs verified_translations into a Phoenix project

Migrates gettext calls and PO translations to ~t

Lists translation files with empty or missing locales, without compiling.

Writes translations into the message's JSON file, creating it when needed.

Lists machine translations a human hasn't reviewed ("origin" with "by": "machine"), with the model that made them, and marks them reviewed.

Compiles the project and lists translation files that no ~t refers to.