phoenixframework / phoenix

Peace of mind from prototype to production
https://www.phoenixframework.org
MIT License
21.46k stars 2.88k forks source link

Deprecated use of Gettext in phx.new #5944

Closed leifmetcalf closed 1 month ago

leifmetcalf commented 1 month ago

Environment

Actual behavior

$ mix phx.new munch_phoenix
* creating munch_phoenix/lib/munch_phoenix/application.ex
* creating munch_phoenix/lib/munch_phoenix.ex
...

Fetch and install dependencies? [Yn] 
* running mix deps.get
* running mix assets.setup
* running mix deps.compile

We are almost there! The following steps are missing:

    $ cd munch_phoenix

Then configure your database in config/dev.exs and run:

    $ mix ecto.create

Start your Phoenix app with:

    $ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

    $ iex -S mix phx.server

$ cd ../munch_phoenix/
$ mix ecto.create
Compiling 15 files (.ex)
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/munch_phoenix_web/gettext.ex:23: MunchPhoenixWeb.Gettext (module)

Generated munch_phoenix app
The database for MunchPhoenix.Repo has been created

Expected behaviour

I've just started learning Elixir and Phoenix so I not confident making the change they suggest in the phx.new template, but I guess

    use Gettext, otp_app: ...

should be replaced by

    use Gettext.Backend, otp_app: :my_app

in gettext.ex

leifmetcalf commented 1 month ago

My bad, this was fixed in #5902.