<commit_before>defmodule Identificator.ErrorHelpers do
  @moduledoc """
  Conveniences for translating and building error messages.
  """

  use Phoenix.HTML

  @doc """
  Generates tag for inlined form input errors.
  """
  def error_tag(form, field) do
    error = form.errors[field]
    if error do
      content_tag :span, translate_error(error), class: "help-block"
    end
  end

  @doc """
  Translates an error message using gettext.
  """
  def translate_error({msg, opts}) do
    # Because error messages were defined within Ecto, we must call the Gettext module passing our
    # Gettext backend. We also use the "errors" domain as translations are placed in the errors.po
    # file. On your own code and templates, his could be written simply as:
    #
    #     dngettext "errors", "1 file", "%{count} files", count
    #
    Gettext.dngettext(Identificator.Gettext, "errors", msg, msg, opts[:count], opts)
  end
<commit_msg>fix gettex on ecto update<commit_after>defmodule Identificator.ErrorHelpers do
  @moduledoc """
  Conveniences for translating and building error messages.
  """

  use Phoenix.HTML

  @doc """
  Generates tag for inlined form input errors.
  """
  def error_tag(form, field) do
    error = form.errors[field]
    if error do
      content_tag :span, translate_error(error), class: "help-block"
    end
  end

  @doc """
  Translates an error message using gettext.
  """
  def translate_error({msg, opts}) do
    # Because error messages were defined within Ecto, we must call the Gettext module passing our
    # Gettext backend. We also use the "errors" domain as translations are placed in the errors.po
    # file. On your own code and templates, his could be written simply as:
    #
    #     dngettext "errors", "1 file", "%{count} files", count
    #
    if count = opts[:count] do
      Gettext.dngettext(Identificator.Gettext, "errors", msg, msg, count || 0, opts)
    else
      Gettext.dgettext(Identificator.Gettext, "errors", msg, opts)
    end
  end

{'fraction_non_alphanumeric': 0.09576059850374065, 'fraction_numerical': 0.0014962593516209476, 'mean_word_length': 3.341991341991342, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7190974', 'n_tokens_mistral': 614, 'n_tokens_neox': 599, 'n_words': 225}