Skip to content

Commit

Permalink
fix pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
woylie committed Dec 12, 2023
1 parent d07c111 commit cbb6ae4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/doggo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,12 @@ defmodule Doggo do

defp field_description_id(id) when is_binary(id), do: "#{id}_description"

defp translate_error({msg, opts}, nil) do
Enum.reduce(opts, msg, fn {key, value}, acc ->
String.replace(acc, "%{#{key}}", fn _ -> to_string(value) end)
end)
end

defp translate_error({msg, opts}, gettext_module)
when is_atom(gettext_module) do
if count = opts[:count] do
Expand All @@ -1477,12 +1483,6 @@ defmodule Doggo do
end
end

defp translate_error({msg, opts}, nil) do
Enum.reduce(opts, msg, fn {key, value}, acc ->
String.replace(acc, "%{#{key}}", fn _ -> to_string(value) end)
end)
end

@doc """
Renders a modal.
Expand Down

0 comments on commit cbb6ae4

Please sign in to comment.