diff --git a/lib/music_library_web/controllers/session_controller.ex b/lib/music_library_web/controllers/session_controller.ex index fd62a6f1..04bd1652 100644 --- a/lib/music_library_web/controllers/session_controller.ex +++ b/lib/music_library_web/controllers/session_controller.ex @@ -16,7 +16,7 @@ defmodule MusicLibraryWeb.SessionController do |> redirect(to: "/") else conn - |> put_flash(:error, "Invalid password") + |> put_flash(:error, gettext("Invalid password")) |> redirect(to: ~p"/login") end end diff --git a/lib/music_library_web/controllers/session_html/new.html.heex b/lib/music_library_web/controllers/session_html/new.html.heex index c3e4d71b..57b7156e 100644 --- a/lib/music_library_web/controllers/session_html/new.html.heex +++ b/lib/music_library_web/controllers/session_html/new.html.heex @@ -2,13 +2,13 @@

- Welcome to your Music Library + <%= gettext("Welcome to your Music Library") %>

<.form class="space-y-6" for={@form} action={~p"/sessions/create"}>
- + - Sign in + <%= gettext("Sign in") %>
diff --git a/lib/music_library_web/plug/require_login.ex b/lib/music_library_web/plug/require_login.ex index 5bcd292f..f9d2cb5f 100644 --- a/lib/music_library_web/plug/require_login.ex +++ b/lib/music_library_web/plug/require_login.ex @@ -1,6 +1,7 @@ defmodule MusicLibraryWeb.Plug.RequireLogin do @behaviour Plug + use Gettext, backend: MusicLibraryWeb.Gettext import Plug.Conn import Phoenix.Controller, only: [put_flash: 3, redirect: 2] @@ -13,7 +14,7 @@ defmodule MusicLibraryWeb.Plug.RequireLogin do conn else conn - |> put_flash(:error, "You must be logged in to access this page") + |> put_flash(:error, gettext("You must be logged in to access this page")) |> redirect(to: "/login") |> halt() end diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot new file mode 100644 index 00000000..5727a8a6 --- /dev/null +++ b/priv/gettext/default.pot @@ -0,0 +1,78 @@ +## This file is a PO Template file. +## +## "msgid"s here are often extracted from source code. +## Add new messages manually only if they're dynamic +## messages that can't be statically extracted. +## +## Run "mix gettext.extract" to bring this file up to +## date. Leave "msgstr"s empty as changing them here has no +## effect: edit them in PO (.po) files instead. +# +msgid "" +msgstr "" + +#: lib/music_library_web/components/core_components.ex:485 +#, elixir-autogen, elixir-format +msgid "Actions" +msgstr "" + +#: lib/music_library_web/components/core_components.ex:160 +#, elixir-autogen, elixir-format +msgid "Attempting to reconnect" +msgstr "" + +#: lib/music_library_web/components/core_components.ex:151 +#, elixir-autogen, elixir-format +msgid "Error!" +msgstr "" + +#: lib/music_library_web/components/core_components.ex:172 +#, elixir-autogen, elixir-format +msgid "Hang in there while we get back on track" +msgstr "" + +#: lib/music_library_web/controllers/session_html/new.html.heex:11 +#, elixir-autogen, elixir-format +msgid "Password" +msgstr "" + +#: lib/music_library_web/controllers/session_html/new.html.heex:29 +#, elixir-autogen, elixir-format +msgid "Sign in" +msgstr "" + +#: lib/music_library_web/components/core_components.ex:167 +#, elixir-autogen, elixir-format +msgid "Something went wrong!" +msgstr "" + +#: lib/music_library_web/components/core_components.ex:150 +#, elixir-autogen, elixir-format +msgid "Success!" +msgstr "" + +#: lib/music_library_web/components/core_components.ex:155 +#, elixir-autogen, elixir-format +msgid "We can't find the internet" +msgstr "" + +#: lib/music_library_web/controllers/session_html/new.html.heex:5 +#, elixir-autogen, elixir-format +msgid "Welcome to your Music Library" +msgstr "" + +#: lib/music_library_web/components/core_components.ex:76 +#: lib/music_library_web/components/core_components.ex:130 +#, elixir-autogen, elixir-format +msgid "close" +msgstr "" + +#: lib/music_library_web/controllers/session_controller.ex:19 +#, elixir-autogen, elixir-format +msgid "Invalid password" +msgstr "" + +#: lib/music_library_web/plug/require_login.ex:17 +#, elixir-autogen, elixir-format +msgid "You must be logged in to access this page" +msgstr ""