Extract session translation strings

This commit is contained in:
Claudio Ortolina
2024-10-21 10:26:55 +01:00
parent fb543d0575
commit 3ea278181e
4 changed files with 84 additions and 5 deletions
@@ -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
@@ -2,13 +2,13 @@
<div class="w-full max-w-sm space-y-10">
<div>
<h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">
Welcome to your Music Library
<%= gettext("Welcome to your Music Library") %>
</h2>
</div>
<.form class="space-y-6" for={@form} action={~p"/sessions/create"}>
<div class="relative -space-y-px rounded-md shadow-sm">
<div>
<label for="password" class="sr-only">Password</label>
<label for="password" class="sr-only"><%= gettext("Password") %></label>
<input
id="password"
name="password"
@@ -26,7 +26,7 @@
type="submit"
class="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
>
Sign in
<%= gettext("Sign in") %>
</button>
</div>
</.form>
+2 -1
View File
@@ -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
+78
View File
@@ -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 ""