fix: adjust gettext usage
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
The new version of [`Gettext`][0] changed the way it's used, to avoid large penalties when recompiling large projects. [0]: https://github.com/elixir-gettext/gettext/blob/main/CHANGELOG.md#v0260
This commit is contained in:
parent
743825d583
commit
796bc056a4
@ -19,10 +19,10 @@ defmodule WabanexWeb do
|
|||||||
|
|
||||||
def controller do
|
def controller do
|
||||||
quote do
|
quote do
|
||||||
|
use Gettext, backend: WabanexWeb.Gettext
|
||||||
use Phoenix.Controller, namespace: WabanexWeb
|
use Phoenix.Controller, namespace: WabanexWeb
|
||||||
|
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
import WabanexWeb.Gettext
|
|
||||||
alias WabanexWeb.Router.Helpers, as: Routes
|
alias WabanexWeb.Router.Helpers, as: Routes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -54,17 +54,18 @@ defmodule WabanexWeb do
|
|||||||
def channel do
|
def channel do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.Channel
|
use Phoenix.Channel
|
||||||
import WabanexWeb.Gettext
|
use Gettext, backend: WabanexWeb.Gettext
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp view_helpers do
|
defp view_helpers do
|
||||||
quote do
|
quote do
|
||||||
|
use Gettext, backend: WabanexWeb.Gettext
|
||||||
|
|
||||||
# Import basic rendering functionality (render, render_layout, etc)
|
# Import basic rendering functionality (render, render_layout, etc)
|
||||||
import Phoenix.View
|
import Phoenix.View
|
||||||
|
|
||||||
import WabanexWeb.ErrorHelpers
|
import WabanexWeb.ErrorHelpers
|
||||||
import WabanexWeb.Gettext
|
|
||||||
alias WabanexWeb.Router.Helpers, as: Routes
|
alias WabanexWeb.Router.Helpers, as: Routes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,7 +5,7 @@ defmodule WabanexWeb.Gettext do
|
|||||||
By using [Gettext](https://hexdocs.pm/gettext),
|
By using [Gettext](https://hexdocs.pm/gettext),
|
||||||
your module gains a set of macros for translations, for example:
|
your module gains a set of macros for translations, for example:
|
||||||
|
|
||||||
import WabanexWeb.Gettext
|
use Gettext, backend: WabanexWeb.Gettext
|
||||||
|
|
||||||
# Simple translation
|
# Simple translation
|
||||||
gettext("Here is the string to translate")
|
gettext("Here is the string to translate")
|
||||||
@ -20,5 +20,5 @@ defmodule WabanexWeb.Gettext do
|
|||||||
|
|
||||||
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
||||||
"""
|
"""
|
||||||
use Gettext, otp_app: :wabanex
|
use Gettext.Backend, otp_app: :wabanex
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user