# `Mix.MishkaCmsCore.GettextTemplates`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mix/mishka_cms_core/gettext_templates.ex#L5)

Writes messages marked outside the core into the core's `.pot` files, for
`mix mishka_cms_core.gettext.gervaz` and `mix mishka_cms_core.gettext.extensions`.

A source is a project and its templates by file name (`"default.pot"`), with references relative
to that project. `merge/3` writes them into the core's `priv/gettext`:

  * a message with a reference into the core is left as it is, since `mix gettext.extract` writes
    its references;
  * any other message the source has gets the source's references, relative to the core, beside
    those of the other sources, and keeps its flags and comments while another source references
    it too; one no other source references is the source's own, and one the core's template lacks
    is added at its end;
  * a reference into the source that the source no longer has is removed, and with it a message no
    source references any longer.

The core's `:excluded_refs_from_purging` matches every reference outside the core, so the next
`mix gettext.extract` keeps what is written here, and `mix gettext.extract --check-up-to-date`
still passes. A template that changes is written and named on the shell.

# `merge`

```elixir
@spec merge(Path.t(), Path.t(), %{required(String.t()) =&gt; Expo.Messages.t()}) :: :ok
```

Writes the `templates` of the project at `source` into the `.pot` files of the core at `core`.

`templates` maps a template's file name to its `Expo.Messages`, with references relative to
`source`. A reference outside `source` is left out. Every template of the core is visited, so the
references of a domain the source no longer marks are removed too.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
