From cbb6ae4d53a5389b20b1169c58bb56c86e060eb3 Mon Sep 17 00:00:00 2001 From: Mathias Polligkeit Date: Wed, 13 Dec 2023 07:40:21 +0900 Subject: [PATCH] fix pattern matching --- lib/doggo.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/doggo.ex b/lib/doggo.ex index d7dcc713..83d88c81 100644 --- a/lib/doggo.ex +++ b/lib/doggo.ex @@ -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 @@ -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.