• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

indocomsoft / ledger / bdf408828b885d6b53c496e61d4d56106342f8ee

pending completion
bdf408828b885d6b53c496e61d4d56106342f8ee

push

github

indocomsoft
Upgrade CI postgres version to 14

102 of 167 relevant lines covered (61.08%)

9.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/ledger_web/views/error_helpers.ex
1
defmodule LedgerWeb.ErrorHelpers do
2
  @moduledoc """
3
  Conveniences for translating and building error messages.
4
  """
5

6
  @doc """
7
  Translates an error message using gettext.
8
  """
9
  def translate_error({msg, opts}) do
10
    # When using gettext, we typically pass the strings we want
11
    # to translate as a static argument:
12
    #
13
    #     # Translate "is invalid" in the "errors" domain
14
    #     dgettext("errors", "is invalid")
15
    #
16
    #     # Translate the number of files with plural rules
17
    #     dngettext("errors", "1 file", "%{count} files", count)
18
    #
19
    # Because the error messages we show in our forms and APIs
20
    # are defined inside Ecto, we need to translate them dynamically.
21
    # This requires us to call the Gettext module passing our gettext
22
    # backend as first argument.
23
    #
24
    # Note we use the "errors" domain, which means translations
25
    # should be written to the errors.po file. The :count option is
26
    # set by Ecto and indicates we should also apply plural rules.
27
    if count = opts[:count] do
×
28
      Gettext.dngettext(LedgerWeb.Gettext, "errors", msg, msg, count, opts)
×
29
    else
30
      Gettext.dgettext(LedgerWeb.Gettext, "errors", msg, opts)
×
31
    end
32
  end
33
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc