# `AshGettext.Extractor`
[🔗](https://github.com/Undeadlol1/ash_gettext/blob/v0.1.0/lib/ash_gettext/extractor.ex#L1)

Shows every text AshGettext translates to `mix gettext.extract`.

`mix gettext.extract` compiles the app and records each Gettext macro it
meets. The texts AshGettext translates are plain strings, not macro calls:
enum labels, attribute labels, `message:` options and the sentences for
Ash's own errors. So while the app compiles, `AshGettext.Enum` and
`AshGettext.Domain` hand each one to `Gettext.Macros.dgettext_noop_with_backend/3`
in the app's own modules, with the backend and text domain the lookups use.

A validation or change module a resource uses is read from its source file:
every `message:` whose value is a plain string is found there. An
interpolated message (`message: "too heavy: #{weight}"`) cannot be a msgid,
so it is reported as a compile warning instead.

# `find_result`

```elixir
@type find_result() :: %{messages: [message()], interpolated: [interpolated()]}
```

# `interpolated`

```elixir
@type interpolated() :: %{path: String.t(), line: pos_integer()}
```

# `message`

```elixir
@type message() :: %{msgid: String.t(), references: [reference_entry()]}
```

# `reference_entry`

```elixir
@type reference_entry() :: %{path: String.t(), line: pos_integer()}
```

# `find_messages`

```elixir
@spec find_messages([{String.t(), String.t()}]) :: find_result()
```

Scan `sources` — a list of `{path, contents}` — for translatable messages.

Returns the extractable msgids with every place they appear, and separately
the interpolated messages that cannot become msgids as written.

# `mark`

```elixir
@spec mark(Macro.Env.t(), module(), String.t(), [String.t()]) :: :ok
```

Marks each text for `mix gettext.extract`, as if `env`'s module had called
`Gettext.Macros.dgettext_noop_with_backend(backend, text_domain, text)`.
Does nothing unless Gettext is extracting.

# `resource_texts`

```elixir
@spec resource_texts(module(), boolean()) :: [String.t()]
```

The texts a resource shows: its written attribute labels and, with
`messages?`, every literal `message` in its DSL and in the app's own
validation, change and preparation modules it uses.

---

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