Skip to content

Commit

Permalink
Minor code improvements (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
crbelaus authored Jul 7, 2024
1 parent 22a54ad commit 82fff24
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/trans/translator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ defmodule Trans.Translator do
end
end

defp translate_fields(%{__struct__: module} = struct, locale, default_locale) when is_list(locale) do
defp translate_fields(%{__struct__: module} = struct, locale, default_locale)
when is_list(locale) do
fields = module.__trans__(:fields)

Enum.reduce(fields, struct, fn field, struct ->
Expand All @@ -193,7 +194,7 @@ defmodule Trans.Translator do
end)
end

defp translate_fields(%{__struct__: module} = struct, locale, default_locale) do
defp translate_fields(%{__struct__: _module} = struct, locale, default_locale) do
translate_fields(struct, [locale], default_locale)
end

Expand Down

0 comments on commit 82fff24

Please sign in to comment.