I try create first app then ecto.create, the warning show like below :
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
TLDR; Take the action stated in the deprecation message.
You’ve found yourself in a small time window when the Phoenix generators (I’m assuming you’re creating a Phoenix app?) haven’t quite caught up with a very recent change in gettext.
For folks who want a push button application of this change, there is a mix task (primarily made to be a demo of igniter tooling, but also usable for this purpose) in igniter.
First, add igniter to your deps:
{:igniter, "~> 0.3"}
and then run mix igniter.update_gettext to apply the change.
EDIT: warning, igniter formats any files it touches, so you may see a larger diff than expected if you aren’t already using the formatter. You can always reject the change
Thanks for the breakdown. For future reference, you can do code blocks that start with ```diff (and end with triple backticks) and you can have lines starting with + or - to demonstrate what must be added / removed. Here’s your first example:
- import MyAppWeb.Gettext
+ use Gettext, backend: MyAppWeb.Gettext