From 82d8f4ce98e7ac99613f85d26c23854bf37a310d Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Tue, 13 May 2025 19:12:42 +0100 Subject: [PATCH] Remove unused translate_errors/1 and translate_errors/2 functions --- .../components/core_components.ex | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/lib/music_library_web/components/core_components.ex b/lib/music_library_web/components/core_components.ex index 47de9883..9aff6c4e 100644 --- a/lib/music_library_web/components/core_components.ex +++ b/lib/music_library_web/components/core_components.ex @@ -197,32 +197,4 @@ defmodule MusicLibraryWeb.CoreComponents do "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"} ) end - - @doc """ - Translates an error message using gettext. - """ - def translate_error({msg, opts}) do - # When using gettext, we typically pass the strings we want - # to translate as a static argument: - # - # # Translate the number of files with plural rules - # dngettext("errors", "1 file", "%{count} files", count) - # - # However the error messages in our forms and APIs are generated - # dynamically, so we need to translate them by calling Gettext - # with our gettext backend as first argument. Translations are - # available in the errors.po file (as we use the "errors" domain). - if count = opts[:count] do - Gettext.dngettext(MusicLibraryWeb.Gettext, "errors", msg, msg, count, opts) - else - Gettext.dgettext(MusicLibraryWeb.Gettext, "errors", msg, opts) - end - end - - @doc """ - Translates the errors for a field from a keyword list of errors. - """ - def translate_errors(errors, field) when is_list(errors) do - for {^field, {msg, opts}} <- errors, do: translate_error({msg, opts}) - end end