# `MishkaCmsCoreWeb.Live.Admin.Components.TranslationGroup`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core_web/live/admin/components/translation_group.ex#L5)

One word in every language — the body of the admin Translations modal and of the visual editor's
Translations sheet alike. A chip per language with its translation, or "Missing", beside it, and
Gervaz's `MishkaCmsCore.Runtime.Translation` form for the one picked.

Both pages keep the group in `:translation_group` and move it only through these, so the two
cannot drift apart:

  * `open/2` — a row's Translate: the key of that row, the first missing language picked
  * `pick/2` — a click on a language
  * `saved/1` — after the form saves: read again, and on to the next missing language
  * `add_language/2` — the word in one more language, published on its site first if need be
  * `close/1`

The picker sends `"translation_pick"` to the page with the row's `id`, and the add row
`"translation_add_language"` with the typed `language`.

# `add_language`

```elixir
@spec add_language(Phoenix.LiveView.Socket.t(), String.t()) ::
  Phoenix.LiveView.Socket.t()
```

Adds `language` to the open word — see `Translations.add_language/4` for who may, and for the
master's bounds — and picks the new language's row. A refusal is a flash, the word unchanged.

# `close`

```elixir
@spec close(Phoenix.LiveView.Socket.t()) :: Phoenix.LiveView.Socket.t()
```

Closes the open key.

# `open`

```elixir
@spec open(Phoenix.LiveView.Socket.t(), String.t()) :: Phoenix.LiveView.Socket.t()
```

Opens the key the row `id` belongs to, the first language still missing picked.

# `pick`

```elixir
@spec pick(Phoenix.LiveView.Socket.t(), String.t()) :: Phoenix.LiveView.Socket.t()
```

Picks the language row `id`, if it is one of the open key's.

# `saved`

```elixir
@spec saved(Phoenix.LiveView.Socket.t()) :: Phoenix.LiveView.Socket.t()
```

Reads the open key again after a save, and picks the next language still missing after the one
just saved — or keeps it, when none is.

# `translation_group`

The key's languages and the form for the picked one — or, for a word the reader may not write,
its value to read.

## Attributes

* `id` (`:string`) (required)
* `group` (`:map`) (required)
* `current_user` (`:any`) (required)

---

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