From 8255e50e1dec6f5c5bd3e9efad59ba148edb837a Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Thu, 12 Sep 2024 14:13:06 +0100 Subject: [PATCH] Address gettext deprecations Deprecation warning: warning: defining a Gettext backend by calling use Gettext, otp_app: ... is deprecated. To define a backend, call: use Gettext.Backend, otp_app: :my_app Then, instead of importing your backend, call this in your module: use Gettext, backend: MyApp.Gettext --- lib/music_library_web.ex | 3 ++- lib/music_library_web/components/core_components.ex | 2 +- lib/music_library_web/gettext.ex | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/music_library_web.ex b/lib/music_library_web.ex index b9b5cee4..f4335dfb 100644 --- a/lib/music_library_web.ex +++ b/lib/music_library_web.ex @@ -42,8 +42,9 @@ defmodule MusicLibraryWeb do formats: [:html, :json], layouts: [html: MusicLibraryWeb.Layouts] + use Gettext, backend: MusicLibraryWeb.Gettext + import Plug.Conn - import MusicLibraryWeb.Gettext unquote(verified_routes()) end diff --git a/lib/music_library_web/components/core_components.ex b/lib/music_library_web/components/core_components.ex index de122de8..74a7272a 100644 --- a/lib/music_library_web/components/core_components.ex +++ b/lib/music_library_web/components/core_components.ex @@ -17,7 +17,7 @@ defmodule MusicLibraryWeb.CoreComponents do use Phoenix.Component alias Phoenix.LiveView.JS - import MusicLibraryWeb.Gettext + use Gettext, backend: MusicLibraryWeb.Gettext @doc """ Renders a modal. diff --git a/lib/music_library_web/gettext.ex b/lib/music_library_web/gettext.ex index fa5790ec..912f127a 100644 --- a/lib/music_library_web/gettext.ex +++ b/lib/music_library_web/gettext.ex @@ -20,5 +20,5 @@ defmodule MusicLibraryWeb.Gettext do See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ - use Gettext, otp_app: :music_library + use Gettext.Backend, otp_app: :music_library end