mix verified_translations.put (verified_translations v0.1.1)

Copy Markdown View Source

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

mix verified_translations.put "Hello %{name}" fi="Hei %{name}" sv="Hej %{name}"
mix verified_translations.put --domain admin "Settings" fi=Asetukset
mix verified_translations.put --from translations.json

--from reads a JSON array of objects shaped like the message files, as printed by mix verified_translations.missing --json. Plural messages take an object of CLDR forms per locale, and the "path" from missing identifies plural and context messages:

[{"msgid": "Hello %{name}", "fi": "Hei %{name}"}, {"msgid": "Save", "fi": "Tallenna"}]

Every locale must be configured and every %{binding} must appear in the msgid, so the result is guaranteed to pass compile-time verification for the given locales. Existing translations of other locales are kept. Run mix verified_translations.missing to see what is left.

Options

  • --domain - message domain, default "default"
  • --from - JSON file with many messages (- reads stdin)
  • --model - the LLM (or machine translation service) that translated, e.g. claude-opus-5-5; falls back to VERIFIED_TRANSLATIONS_MODEL. Recorded in the file's "origin": "origin": {"fi": {"by": "machine", "model": "claude-opus-5-5"}}
  • --human - the translations were written or checked by a person. Without it they are recorded as machine translations and show up in mix verified_translations.review until a person approves them. AI agents must not pass it.