chore: adjust Gettext definition and usage

This commit is contained in:
Joao P Dubas 2024-10-29 23:35:42 +00:00
parent 78e35ded8e
commit 7421c820e5
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View file

@ -21,13 +21,14 @@ defmodule LiveBeatsWeb do
def controller do
quote do
use Gettext, backend: LiveBeatsWeb.Gettext
use Phoenix.Controller,
namespace: LiveBeatsWeb,
formats: [:html, :json],
layouts: [html: LiveBeatsWeb.Layouts]
import Plug.Conn
import LiveBeatsWeb.Gettext
alias LiveBeatsWeb.Router.Helpers, as: Routes
unquote(verified_routes())
end
@ -92,8 +93,8 @@ defmodule LiveBeatsWeb do
def channel do
quote do
use Gettext, backend: LiveBeatsWeb.Gettext
use Phoenix.Channel
import LiveBeatsWeb.Gettext
end
end
@ -102,10 +103,10 @@ defmodule LiveBeatsWeb do
# Use all HTML functionality (forms, tags, etc)
import Phoenix.HTML
import Phoenix.HTML.Form
use Gettext, backend: LiveBeatsWeb.Gettext
use PhoenixHTMLHelpers
import LiveBeatsWeb.CoreComponents
import LiveBeatsWeb.Gettext
alias LiveBeatsWeb.Router.Helpers, as: Routes
alias Phoenix.LiveView.JS
unquote(verified_routes())

View file

@ -5,7 +5,7 @@ defmodule LiveBeatsWeb.Gettext do
By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example:
import LiveBeatsWeb.Gettext
use Gettext, backend: LiveBeatsWeb.Gettext
# Simple translation
gettext("Here is the string to translate")
@ -20,5 +20,5 @@ defmodule LiveBeatsWeb.Gettext do
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
use Gettext, otp_app: :live_beats
use Gettext.Backend, otp_app: :live_beats
end