defmodule MvWeb.Translations.FieldTypes do
  @moduledoc """
  Helper module to dynamically translate field types.

  ## Features
  - Can be used in templates to dynamically translate technical field type words to human friendly text

  ## Example
  assigns = assign(assigns, :field_type_label, &MvWeb.Translations.FieldTypes.label/1)
  In template:
  <%= @field_type_label.(custom_field.value_type) %>
  """
  use Gettext, backend: MvWeb.Gettext

  @spec label(atom()) :: String.t()
  def label(:string), do: gettext("Text")
  def label(:integer), do: gettext("Number")
  def label(:boolean), do: gettext("Yes/No-Selection")
  def label(:date), do: gettext("Date")
  def label(:email), do: gettext("E-Mail")
end
