Extract form component translations

This commit is contained in:
Claudio Ortolina
2024-10-21 11:41:14 +01:00
parent 685be03ccf
commit 15553a85a0
2 changed files with 63 additions and 10 deletions
@@ -30,25 +30,27 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
<.input <.input
field={@form[:type]} field={@form[:type]}
type="select" type="select"
label="Type" label={gettext("Type")}
prompt="Choose a value" prompt={gettext("Choose a value")}
options={Ecto.Enum.values(MusicLibrary.Records.Record, :type)} options={Ecto.Enum.values(MusicLibrary.Records.Record, :type)}
/> />
<.input <.input
field={@form[:format]} field={@form[:format]}
type="select" type="select"
label="Format" label={gettext("Format")}
prompt="Choose a value" prompt={gettext("Choose a value")}
options={Ecto.Enum.values(MusicLibrary.Records.Record, :format)} options={Ecto.Enum.values(MusicLibrary.Records.Record, :format)}
/> />
</div> </div>
<.input field={@form[:release]} type="text" label="Release" /> <.input field={@form[:release]} type="text" label={gettext("Release")} />
<.input field={@form[:purchased_at]} type="datetime-local" label="Purchased at" /> <.input field={@form[:purchased_at]} type="datetime-local" label={gettext("Purchased at")} />
<div phx-drop-target={@uploads.cover_data.ref}> <div phx-drop-target={@uploads.cover_data.ref}>
<.label for={@uploads.cover_data.ref}> <.label for={@uploads.cover_data.ref}>
Cover art <%= gettext("Cover art") %>
</.label> </.label>
<span :if={@uploads.cover_data.entries == []} class="float-right">No cover selected</span> <span :if={@uploads.cover_data.entries == []} class="float-right">
<%= gettext("No cover selected") %>
</span>
<%= for entry <- @uploads.cover_data.entries do %> <%= for entry <- @uploads.cover_data.entries do %>
<span class="float-right"><%= entry.progress %>%</span> <span class="float-right"><%= entry.progress %>%</span>
<% end %> <% end %>
@@ -58,7 +60,7 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
/> />
</div> </div>
<:actions> <:actions>
<.button phx-disable-with="Saving...">Save</.button> <.button phx-disable-with={gettext("Saving...")}><%= gettext("Save") %></.button>
</:actions> </:actions>
</.simple_form> </.simple_form>
</div> </div>
@@ -103,7 +105,7 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
{:noreply, {:noreply,
socket socket
|> put_flash(:info, "Record updated successfully") |> put_flash(:info, gettext("Record updated successfully"))
|> push_patch(to: socket.assigns.patch)} |> push_patch(to: socket.assigns.patch)}
{:error, %Ecto.Changeset{} = changeset} -> {:error, %Ecto.Changeset{} = changeset} ->
+51
View File
@@ -114,3 +114,54 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Total Records" msgid "Total Records"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:34
#: lib/music_library_web/live/record_live/form_component.ex:41
#, elixir-autogen, elixir-format
msgid "Choose a value"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:49
#, elixir-autogen, elixir-format
msgid "Cover art"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:40
#, elixir-autogen, elixir-format
msgid "Format"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:52
#, elixir-autogen, elixir-format
msgid "No cover selected"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:46
#, elixir-autogen, elixir-format
msgid "Purchased at"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:108
#, elixir-autogen, elixir-format
msgid "Record updated successfully"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:45
#, elixir-autogen, elixir-format
msgid "Release"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:63
#, elixir-autogen, elixir-format
msgid "Save"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:63
#, elixir-autogen, elixir-format
msgid "Saving..."
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:33
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""