Refactor type/format labels to enable translations

This commit is contained in:
Claudio Ortolina
2025-01-29 11:04:19 +00:00
parent 96bd453900
commit 9e1f00c9a8
16 changed files with 193 additions and 132 deletions
-22
View File
@@ -188,28 +188,6 @@ defmodule MusicLibrary.Records.Record do
def formats, do: @formats def formats, do: @formats
def types, do: @types def types, do: @types
def formats_with_labels do
Enum.map(@formats, fn f -> {format_long_label(f), f} end)
end
def types_with_labels do
Enum.map(@types, fn t -> {type_long_label(t), t} end)
end
def format_long_label(:cd), do: "CD"
def format_long_label(:backup), do: "Backup"
def format_long_label(:vinyl), do: "Vinyl"
def format_long_label(:blu_ray), do: "Blu-ray"
def format_long_label(:dvd), do: "DVD"
def format_long_label(:multi), do: "Multi"
def type_long_label(:album), do: "Album"
def type_long_label(:ep), do: "EP"
def type_long_label(:live), do: "Live"
def type_long_label(:compilation), do: "Comp"
def type_long_label(:single), do: "Single"
def type_long_label(:other), do: "Other"
def format_release(nil), do: "N/A" def format_release(nil), do: "N/A"
def format_release(release) do def format_release(release) do
@@ -49,9 +49,7 @@ defmodule MusicLibraryWeb.RecordComponents do
</span> </span>
</p> </p>
<p class="sm:hidden mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400"> <p class="sm:hidden mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400">
{Records.Record.format_long_label(record.format)} · {Records.Record.type_long_label( {format_label(record.format)} · {type_label(record.type)}
record.type
)}
<span :if={Records.Record.child_release_groups_count(record) > 0}> <span :if={Records.Record.child_release_groups_count(record) > 0}>
· ·
<span class="sr-only"> <span class="sr-only">
@@ -78,9 +76,7 @@ defmodule MusicLibraryWeb.RecordComponents do
<div class="flex shrink-0 items-center gap-x-6"> <div class="flex shrink-0 items-center gap-x-6">
<div class="hidden sm:flex sm:flex-col sm:items-end"> <div class="hidden sm:flex sm:flex-col sm:items-end">
<p class="text-xs leading-6 text-zinc-900 dark:text-zinc-300"> <p class="text-xs leading-6 text-zinc-900 dark:text-zinc-300">
{Records.Record.format_long_label(record.format)} · {Records.Record.type_long_label( {format_label(record.format)} · {type_label(record.type)}
record.type
)}
<span :if={Records.Record.child_release_groups_count(record) > 0}> <span :if={Records.Record.child_release_groups_count(record) > 0}>
· ·
<span class="sr-only"> <span class="sr-only">
@@ -213,6 +209,20 @@ defmodule MusicLibraryWeb.RecordComponents do
""" """
end end
def format_label(:cd), do: gettext("CD")
def format_label(:backup), do: gettext("Backup")
def format_label(:vinyl), do: gettext("Vinyl")
def format_label(:blu_ray), do: gettext("Blu-ray")
def format_label(:dvd), do: gettext("DVD")
def format_label(:multi), do: gettext("Multi")
def type_label(:album), do: gettext("Album")
def type_label(:ep), do: gettext("EP")
def type_label(:live), do: gettext("Live")
def type_label(:compilation), do: gettext("Comp")
def type_label(:single), do: gettext("Single")
def type_label(:other), do: gettext("Other")
def toggle_actions_menu(record_id) do def toggle_actions_menu(record_id) do
JS.toggle(to: "#actions-#{record_id}") JS.toggle(to: "#actions-#{record_id}")
|> JS.toggle_class("pointer-events-none", to: "#records > li") |> JS.toggle_class("pointer-events-none", to: "#records > li")
@@ -1,6 +1,7 @@
defmodule MusicLibraryWeb.ArtistLive.RecordComponents do defmodule MusicLibraryWeb.ArtistLive.RecordComponents do
use MusicLibraryWeb, :live_component use MusicLibraryWeb, :live_component
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.Records alias MusicLibrary.Records
attr :records, :list, required: true attr :records, :list, required: true
@@ -46,9 +47,7 @@ defmodule MusicLibraryWeb.ArtistLive.RecordComponents do
{record.title} {record.title}
</p> </p>
<p class="pointer-events-none block text-sm font-medium text-zinc-500"> <p class="pointer-events-none block text-sm font-medium text-zinc-500">
{Records.Record.format_long_label(record.format)} · {Records.Record.type_long_label( {format_label(record.format)} · {type_label(record.type)}
record.type
)}
</p> </p>
<p class="pointer-events-none block text-sm font-medium text-zinc-500"> <p class="pointer-events-none block text-sm font-medium text-zinc-500">
{Records.Record.format_release(record.release)} {Records.Record.format_release(record.release)}
@@ -1,7 +1,9 @@
defmodule MusicLibraryWeb.CollectionLive.Show do defmodule MusicLibraryWeb.CollectionLive.Show do
use MusicLibraryWeb, :live_view use MusicLibraryWeb, :live_view
import MusicLibraryWeb.RecordComponents, only: [toggle_actions_menu: 1, close_actions_menu: 1] import MusicLibraryWeb.RecordComponents,
only: [toggle_actions_menu: 1, close_actions_menu: 1, format_label: 1, type_label: 1]
alias Phoenix.LiveView.JS alias Phoenix.LiveView.JS
alias MusicLibrary.Records alias MusicLibrary.Records
@@ -22,9 +22,9 @@
{@record.title} {@record.title}
</h2> </h2>
<p class="mt-2 text-sm leading-5 text-zinc-500 dark:text-zinc-400"> <p class="mt-2 text-sm leading-5 text-zinc-500 dark:text-zinc-400">
{Records.Record.format_release(@record.release)} · {Records.Record.format_long_label( {Records.Record.format_release(@record.release)} · {format_label(@record.format)} · {type_label(
@record.format @record.type
)} · {Records.Record.type_long_label(@record.type)} )}
</p> </p>
</div> </div>
<div class="relative flex-none"> <div class="relative flex-none">
@@ -1,6 +1,7 @@
defmodule MusicLibraryWeb.RecordLive.FormComponent do defmodule MusicLibraryWeb.RecordLive.FormComponent do
use MusicLibraryWeb, :live_component use MusicLibraryWeb, :live_component
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.Records alias MusicLibrary.Records
alias MusicLibrary.Records.Cover alias MusicLibrary.Records.Cover
@@ -37,14 +38,14 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
type="select" type="select"
label={gettext("Type")} label={gettext("Type")}
prompt={gettext("Choose a value")} prompt={gettext("Choose a value")}
options={Records.Record.types_with_labels()} options={types_with_labels()}
/> />
<.input <.input
field={@form[:format]} field={@form[:format]}
type="select" type="select"
label={gettext("Format")} label={gettext("Format")}
prompt={gettext("Choose a value")} prompt={gettext("Choose a value")}
options={Records.Record.formats_with_labels()} options={formats_with_labels()}
/> />
</div> </div>
<.input field={@form[:musicbrainz_id]} type="text" label={gettext("MusicBrainz ID")} /> <.input field={@form[:musicbrainz_id]} type="text" label={gettext("MusicBrainz ID")} />
@@ -132,5 +133,13 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
end end
end end
def formats_with_labels do
Enum.map(Records.Record.formats(), fn f -> {format_label(f), f} end)
end
def types_with_labels do
Enum.map(Records.Record.types(), fn t -> {type_label(t), t} end)
end
defp notify_parent(msg), do: send(self(), {__MODULE__, msg}) defp notify_parent(msg), do: send(self(), {__MODULE__, msg})
end end
@@ -1,7 +1,9 @@
defmodule MusicLibraryWeb.RecordLive.ImportComponent do defmodule MusicLibraryWeb.RecordLive.ImportComponent do
use MusicLibraryWeb, :live_component use MusicLibraryWeb, :live_component
import MusicLibraryWeb.RecordComponents, only: [toggle_actions_menu: 1, close_actions_menu: 1] import MusicLibraryWeb.RecordComponents,
only: [toggle_actions_menu: 1, close_actions_menu: 1, format_label: 1, type_label: 1]
alias MusicLibrary.Records alias MusicLibrary.Records
@impl true @impl true
@@ -68,9 +70,7 @@ defmodule MusicLibraryWeb.RecordLive.ImportComponent do
{@release_group.title} {@release_group.title}
</h2> </h2>
<p class="mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400"> <p class="mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400">
{Records.Record.format_release(@release_group.release)} · {Records.Record.type_long_label( {Records.Record.format_release(@release_group.release)} · {type_label(@release_group.type)}
@release_group.type
)}
</p> </p>
</div> </div>
<div class="relative flex-none"> <div class="relative flex-none">
@@ -115,7 +115,7 @@ defmodule MusicLibraryWeb.RecordLive.ImportComponent do
JS.push("import", value: %{id: @release_group.id, format: format}, page_loading: true) JS.push("import", value: %{id: @release_group.id, format: format}, page_loading: true)
} }
> >
{Records.Record.format_long_label(format)} {format_label(format)}
</.link> </.link>
</.focus_wrap> </.focus_wrap>
</div> </div>
@@ -2,9 +2,9 @@ defmodule MusicLibraryWeb.StatsLive.Index do
use MusicLibraryWeb, :live_view use MusicLibraryWeb, :live_view
import MusicLibraryWeb.StatsLive.DataComponents import MusicLibraryWeb.StatsLive.DataComponents
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.{Artists, Collection, Records, Wishlist} alias MusicLibrary.{Artists, Collection, Records, Wishlist}
alias Records.Record
def mount(_params, _session, socket) do def mount(_params, _session, socket) do
latest_record = Collection.get_latest_record!() latest_record = Collection.get_latest_record!()
@@ -29,7 +29,7 @@
]}> ]}>
<div :for={{format, count} <- @collection_count_by_format} class="px-2 py-5 sm:px-4"> <div :for={{format, count} <- @collection_count_by_format} class="px-2 py-5 sm:px-4">
<dt class="text-sm font-medium text-zinc-500 dark:text-zinc-400 text-center max-sm:text-xs break-keep"> <dt class="text-sm font-medium text-zinc-500 dark:text-zinc-400 text-center max-sm:text-xs break-keep">
{Record.format_long_label(format)} {format_label(format)}
</dt> </dt>
<dd class="mt-1 text-center"> <dd class="mt-1 text-center">
<.link <.link
@@ -54,7 +54,7 @@
]}> ]}>
<div :for={{type, count} <- @collection_count_by_type} class="px-2 py-5 sm:px-4"> <div :for={{type, count} <- @collection_count_by_type} class="px-2 py-5 sm:px-4">
<dt class="text-sm font-medium text-zinc-500 dark:text-zinc-400 text-center max-sm:text-xs break-keep"> <dt class="text-sm font-medium text-zinc-500 dark:text-zinc-400 text-center max-sm:text-xs break-keep">
{Record.type_long_label(type)} {type_label(type)}
</dt> </dt>
<dd class="mt-1 text-center"> <dd class="mt-1 text-center">
<.link <.link
@@ -202,7 +202,7 @@
) )
} }
> >
{Records.Record.format_long_label(format)} {format_label(format)}
</.link> </.link>
</.focus_wrap> </.focus_wrap>
</div> </div>
@@ -1,7 +1,9 @@
defmodule MusicLibraryWeb.WishlistLive.Show do defmodule MusicLibraryWeb.WishlistLive.Show do
use MusicLibraryWeb, :live_view use MusicLibraryWeb, :live_view
import MusicLibraryWeb.RecordComponents, only: [toggle_actions_menu: 1, close_actions_menu: 1] import MusicLibraryWeb.RecordComponents,
only: [toggle_actions_menu: 1, close_actions_menu: 1, format_label: 1, type_label: 1]
alias MusicLibrary.Records alias MusicLibrary.Records
@impl true @impl true
@@ -26,9 +26,7 @@
<span :if={@current_date && !Records.Record.released?(@record, @current_date)}> <span :if={@current_date && !Records.Record.released?(@record, @current_date)}>
({gettext("Unreleased")}) ({gettext("Unreleased")})
</span> </span>
· {Records.Record.format_long_label(@record.format)} · {Records.Record.type_long_label( · {format_label(@record.format)} · {type_label(@record.type)}
@record.type
)}
</p> </p>
</div> </div>
<div class="relative flex-none"> <div class="relative flex-none">
+129 -69
View File
@@ -16,15 +16,15 @@ msgstr ""
msgid "Actions" msgid "Actions"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:185 #: lib/music_library_web/components/record_components.ex:181
#: lib/music_library_web/live/collection_live/show.html.heex:127 #: lib/music_library_web/live/collection_live/show.html.heex:127
#: lib/music_library_web/live/wishlist_live/show.html.heex:148 #: lib/music_library_web/live/wishlist_live/show.html.heex:146
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure?" msgid "Are you sure?"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:39 #: lib/music_library_web/live/record_live/form_component.ex:40
#: lib/music_library_web/live/record_live/form_component.ex:46 #: lib/music_library_web/live/record_live/form_component.ex:47
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Choose a value" msgid "Choose a value"
msgstr "" msgstr ""
@@ -32,29 +32,29 @@ msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex:14 #: lib/music_library_web/components/layouts/app.html.heex:14
#: lib/music_library_web/live/artist_live/show.html.heex:67 #: lib/music_library_web/live/artist_live/show.html.heex:67
#: lib/music_library_web/live/collection_live/index.ex:143 #: lib/music_library_web/live/collection_live/index.ex:143
#: lib/music_library_web/live/collection_live/show.ex:115 #: lib/music_library_web/live/collection_live/show.ex:117
#: lib/music_library_web/live/collection_live/show.ex:132 #: lib/music_library_web/live/collection_live/show.ex:134
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Collection" msgid "Collection"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:60 #: lib/music_library_web/live/record_live/form_component.ex:61
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Cover art" msgid "Cover art"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:187 #: lib/music_library_web/components/record_components.ex:183
#: lib/music_library_web/live/collection_live/show.html.heex:135 #: lib/music_library_web/live/collection_live/show.html.heex:135
#: lib/music_library_web/live/wishlist_live/show.html.heex:156 #: lib/music_library_web/live/wishlist_live/show.html.heex:154
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Delete" msgid "Delete"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:165 #: lib/music_library_web/components/record_components.ex:161
#: lib/music_library_web/live/collection_live/show.ex:139 #: lib/music_library_web/live/collection_live/show.ex:141
#: lib/music_library_web/live/collection_live/show.html.heex:70 #: lib/music_library_web/live/collection_live/show.html.heex:70
#: lib/music_library_web/live/wishlist_live/show.ex:142 #: lib/music_library_web/live/wishlist_live/show.ex:144
#: lib/music_library_web/live/wishlist_live/show.html.heex:74 #: lib/music_library_web/live/wishlist_live/show.html.heex:72
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit" msgid "Edit"
msgstr "" msgstr ""
@@ -74,7 +74,7 @@ msgstr ""
msgid "Error!" msgid "Error!"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:45 #: lib/music_library_web/live/record_live/form_component.ex:46
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Format" msgid "Format"
msgstr "" msgstr ""
@@ -85,7 +85,7 @@ msgid "Formats"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:165 #: lib/music_library_web/live/collection_live/show.html.heex:165
#: lib/music_library_web/live/wishlist_live/show.html.heex:187 #: lib/music_library_web/live/wishlist_live/show.html.heex:185
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Genres" msgid "Genres"
msgstr "" msgstr ""
@@ -102,7 +102,7 @@ msgid "Import"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:224 #: lib/music_library_web/live/collection_live/show.html.heex:224
#: lib/music_library_web/live/wishlist_live/show.html.heex:238 #: lib/music_library_web/live/wishlist_live/show.html.heex:236
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Inserted at" msgid "Inserted at"
msgstr "" msgstr ""
@@ -129,8 +129,8 @@ msgid "Logout"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:179 #: lib/music_library_web/live/collection_live/show.html.heex:179
#: lib/music_library_web/live/record_live/form_component.ex:50 #: lib/music_library_web/live/record_live/form_component.ex:51
#: lib/music_library_web/live/wishlist_live/show.html.heex:201 #: lib/music_library_web/live/wishlist_live/show.html.heex:199
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "MusicBrainz ID" msgid "MusicBrainz ID"
msgstr "" msgstr ""
@@ -141,19 +141,19 @@ msgstr ""
msgid "Next" msgid "Next"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:67 #: lib/music_library_web/live/record_live/form_component.ex:68
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "No cover selected" msgid "No cover selected"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/import_component.ex:42 #: lib/music_library_web/live/record_live/import_component.ex:44
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "No results" msgid "No results"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:110 #: lib/music_library_web/components/record_components.ex:106
#: lib/music_library_web/live/collection_live/show.html.heex:38 #: lib/music_library_web/live/collection_live/show.html.heex:38
#: lib/music_library_web/live/wishlist_live/show.html.heex:42 #: lib/music_library_web/live/wishlist_live/show.html.heex:40
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Open options" msgid "Open options"
msgstr "" msgstr ""
@@ -169,20 +169,20 @@ msgstr ""
msgid "Previous" msgid "Previous"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:176 #: lib/music_library_web/components/record_components.ex:172
#: lib/music_library_web/live/collection_live/index.html.heex:42 #: lib/music_library_web/live/collection_live/index.html.heex:42
#: lib/music_library_web/live/wishlist_live/show.html.heex:139 #: lib/music_library_web/live/wishlist_live/show.html.heex:137
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Purchase" msgid "Purchase"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:56 #: lib/music_library_web/live/record_live/form_component.ex:57
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Purchased at" msgid "Purchased at"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:65 #: lib/music_library_web/components/record_components.ex:63
#: lib/music_library_web/components/record_components.ex:94 #: lib/music_library_web/components/record_components.ex:90
#: lib/music_library_web/live/collection_live/show.html.heex:201 #: lib/music_library_web/live/collection_live/show.html.heex:201
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Purchased on" msgid "Purchased on"
@@ -195,46 +195,46 @@ msgstr ""
msgid "Record imported successfully" msgid "Record imported successfully"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:127 #: lib/music_library_web/live/record_live/form_component.ex:128
#: lib/music_library_web/live/wishlist_live/index.ex:140 #: lib/music_library_web/live/wishlist_live/index.ex:140
#: lib/music_library_web/live/wishlist_live/show.ex:111 #: lib/music_library_web/live/wishlist_live/show.ex:113
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record updated successfully" msgid "Record updated successfully"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:51 #: lib/music_library_web/live/record_live/form_component.ex:52
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Release" msgid "Release"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:78 #: lib/music_library_web/live/record_live/form_component.ex:79
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Save" msgid "Save"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:78 #: lib/music_library_web/live/record_live/form_component.ex:79
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Saving..." msgid "Saving..."
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:207 #: lib/music_library_web/components/record_components.ex:203
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/import_component.ex:24 #: lib/music_library_web/live/record_live/import_component.ex:26
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search for a record on MusicBrainz" msgid "Search for a record on MusicBrainz"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/import_component.ex:25 #: lib/music_library_web/live/record_live/import_component.ex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search for records" msgid "Search for records"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:145 #: lib/music_library_web/components/record_components.ex:141
#: lib/music_library_web/live/collection_live/show.ex:138 #: lib/music_library_web/live/collection_live/show.ex:140
#: lib/music_library_web/live/wishlist_live/show.ex:141 #: lib/music_library_web/live/wishlist_live/show.ex:143
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Show" msgid "Show"
msgstr "" msgstr ""
@@ -262,9 +262,9 @@ msgid "Success!"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/index.ex:21 #: lib/music_library_web/live/collection_live/index.ex:21
#: lib/music_library_web/live/collection_live/show.ex:12 #: lib/music_library_web/live/collection_live/show.ex:14
#: lib/music_library_web/live/wishlist_live/index.ex:21 #: lib/music_library_web/live/wishlist_live/index.ex:21
#: lib/music_library_web/live/wishlist_live/show.ex:11 #: lib/music_library_web/live/wishlist_live/show.ex:13
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "The application has been updated, please reload." msgid "The application has been updated, please reload."
msgstr "" msgstr ""
@@ -279,7 +279,7 @@ msgstr ""
msgid "Total wishlist" msgid "Total wishlist"
msgstr "" msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:38 #: lib/music_library_web/live/record_live/form_component.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type" msgid "Type"
msgstr "" msgstr ""
@@ -290,12 +290,12 @@ msgid "Types"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:232 #: lib/music_library_web/live/collection_live/show.html.heex:232
#: lib/music_library_web/live/wishlist_live/show.html.heex:246 #: lib/music_library_web/live/wishlist_live/show.html.heex:244
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Updated at" msgid "Updated at"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:155 #: lib/music_library_web/components/record_components.ex:151
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "View on MusicBrainz" msgid "View on MusicBrainz"
msgstr "" msgstr ""
@@ -308,7 +308,7 @@ msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex:20 #: lib/music_library_web/components/layouts/app.html.heex:20
#: lib/music_library_web/live/artist_live/show.html.heex:76 #: lib/music_library_web/live/artist_live/show.html.heex:76
#: lib/music_library_web/live/wishlist_live/index.ex:159 #: lib/music_library_web/live/wishlist_live/index.ex:159
#: lib/music_library_web/live/wishlist_live/show.ex:135 #: lib/music_library_web/live/wishlist_live/show.ex:137
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Wishlist" msgid "Wishlist"
msgstr "" msgstr ""
@@ -325,13 +325,13 @@ msgid "close"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:189 #: lib/music_library_web/live/collection_live/show.html.heex:189
#: lib/music_library_web/live/wishlist_live/show.html.heex:211 #: lib/music_library_web/live/wishlist_live/show.html.heex:209
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Copy MusicBrainz ID to clipboard" msgid "Copy MusicBrainz ID to clipboard"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:243 #: lib/music_library_web/live/collection_live/show.html.heex:243
#: lib/music_library_web/live/wishlist_live/show.html.heex:257 #: lib/music_library_web/live/wishlist_live/show.html.heex:255
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "MusicBrainz data" msgid "MusicBrainz data"
msgstr "" msgstr ""
@@ -357,26 +357,26 @@ msgstr ""
msgid "Wishlisted" msgid "Wishlisted"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:58 #: lib/music_library_web/components/record_components.ex:56
#: lib/music_library_web/components/record_components.ex:87 #: lib/music_library_web/components/record_components.ex:83
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Number of included records" msgid "Number of included records"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:212 #: lib/music_library_web/live/collection_live/show.html.heex:212
#: lib/music_library_web/live/wishlist_live/show.html.heex:226 #: lib/music_library_web/live/wishlist_live/show.html.heex:224
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Includes" msgid "Includes"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:54 #: lib/music_library_web/live/collection_live/show.ex:56
#: lib/music_library_web/live/wishlist_live/show.ex:58 #: lib/music_library_web/live/wishlist_live/show.ex:60
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Error refreshing MusicBrainz data" msgid "Error refreshing MusicBrainz data"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:46 #: lib/music_library_web/live/collection_live/show.ex:48
#: lib/music_library_web/live/wishlist_live/show.ex:50 #: lib/music_library_web/live/wishlist_live/show.ex:52
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "MusicBrainz data refreshed successfully" msgid "MusicBrainz data refreshed successfully"
msgstr "" msgstr ""
@@ -386,18 +386,18 @@ msgstr ""
msgid "Refresh LastFm Feed" msgid "Refresh LastFm Feed"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:86 #: lib/music_library_web/live/collection_live/show.ex:88
#: lib/music_library_web/live/wishlist_live/show.ex:70 #: lib/music_library_web/live/wishlist_live/show.ex:72
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Cover refreshed successfully" msgid "Cover refreshed successfully"
msgstr "" msgstr ""
#: lib/music_library_web/live/wishlist_live/show.ex:78 #: lib/music_library_web/live/wishlist_live/show.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Error refreshing Cover" msgid "Error refreshing Cover"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:94 #: lib/music_library_web/live/collection_live/show.ex:96
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Error refreshing cover" msgid "Error refreshing cover"
msgstr "" msgstr ""
@@ -408,7 +408,7 @@ msgid "No MB ID"
msgstr "" msgstr ""
#: lib/music_library_web/live/artist_live/show.ex:42 #: lib/music_library_web/live/artist_live/show.ex:42
#: lib/music_library_web/live/collection_live/show.ex:113 #: lib/music_library_web/live/collection_live/show.ex:115
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Details" msgid "Details"
msgstr "" msgstr ""
@@ -433,7 +433,7 @@ msgstr ""
msgid "Dev dashboard" msgid "Dev dashboard"
msgstr "" msgstr ""
#: lib/music_library_web/live/artist_live/record_components.ex:42 #: lib/music_library_web/live/artist_live/record_components.ex:43
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "View details" msgid "View details"
msgstr "" msgstr ""
@@ -453,32 +453,32 @@ msgstr ""
msgid "Loading play count" msgid "Loading play count"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:74 #: lib/music_library_web/live/collection_live/show.ex:76
#: lib/music_library_web/live/wishlist_live/show.ex:98 #: lib/music_library_web/live/wishlist_live/show.ex:100
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Error populating genres" msgid "Error populating genres"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:66 #: lib/music_library_web/live/collection_live/show.ex:68
#: lib/music_library_web/live/wishlist_live/show.ex:90 #: lib/music_library_web/live/wishlist_live/show.ex:92
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Genres populated successfully" msgid "Genres populated successfully"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:118 #: lib/music_library_web/live/collection_live/show.html.heex:118
#: lib/music_library_web/live/wishlist_live/show.html.heex:122 #: lib/music_library_web/live/wishlist_live/show.html.heex:120
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Populate genres" msgid "Populate genres"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:102 #: lib/music_library_web/live/collection_live/show.html.heex:102
#: lib/music_library_web/live/wishlist_live/show.html.heex:106 #: lib/music_library_web/live/wishlist_live/show.html.heex:104
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Refresh MB data" msgid "Refresh MB data"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:86 #: lib/music_library_web/live/collection_live/show.html.heex:86
#: lib/music_library_web/live/wishlist_live/show.html.heex:90 #: lib/music_library_web/live/wishlist_live/show.html.heex:88
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Refresh cover" msgid "Refresh cover"
msgstr "" msgstr ""
@@ -513,7 +513,7 @@ msgstr ""
msgid "On Tour" msgid "On Tour"
msgstr "" msgstr ""
#: lib/music_library_web/live/artist_live/record_components.ex:20 #: lib/music_library_web/live/artist_live/record_components.ex:21
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "1 record" msgid "1 record"
msgid_plural "%{count} records" msgid_plural "%{count} records"
@@ -528,13 +528,13 @@ msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: lib/music_library_web/live/collection_live/show.html.heex:153 #: lib/music_library_web/live/collection_live/show.html.heex:153
#: lib/music_library_web/live/wishlist_live/show.html.heex:175 #: lib/music_library_web/live/wishlist_live/show.html.heex:173
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Copy record ID to clipboard" msgid "Copy record ID to clipboard"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:145 #: lib/music_library_web/live/collection_live/show.html.heex:145
#: lib/music_library_web/live/wishlist_live/show.html.heex:167 #: lib/music_library_web/live/wishlist_live/show.html.heex:165
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "ID" msgid "ID"
msgstr "" msgstr ""
@@ -544,3 +544,63 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unreleased" msgid "Unreleased"
msgstr "" msgstr ""
#: lib/music_library_web/components/record_components.ex:219
#, elixir-autogen, elixir-format
msgid "Album"
msgstr ""
#: lib/music_library_web/components/record_components.ex:213
#, elixir-autogen, elixir-format
msgid "Backup"
msgstr ""
#: lib/music_library_web/components/record_components.ex:215
#, elixir-autogen, elixir-format
msgid "Blu-ray"
msgstr ""
#: lib/music_library_web/components/record_components.ex:212
#, elixir-autogen, elixir-format
msgid "CD"
msgstr ""
#: lib/music_library_web/components/record_components.ex:222
#, elixir-autogen, elixir-format
msgid "Comp"
msgstr ""
#: lib/music_library_web/components/record_components.ex:216
#, elixir-autogen, elixir-format
msgid "DVD"
msgstr ""
#: lib/music_library_web/components/record_components.ex:220
#, elixir-autogen, elixir-format
msgid "EP"
msgstr ""
#: lib/music_library_web/components/record_components.ex:221
#, elixir-autogen, elixir-format
msgid "Live"
msgstr ""
#: lib/music_library_web/components/record_components.ex:217
#, elixir-autogen, elixir-format
msgid "Multi"
msgstr ""
#: lib/music_library_web/components/record_components.ex:224
#, elixir-autogen, elixir-format
msgid "Other"
msgstr ""
#: lib/music_library_web/components/record_components.ex:223
#, elixir-autogen, elixir-format
msgid "Single"
msgstr ""
#: lib/music_library_web/components/record_components.ex:214
#, elixir-autogen, elixir-format
msgid "Vinyl"
msgstr ""
@@ -3,6 +3,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
import MusicLibrary.RecordsFixtures import MusicLibrary.RecordsFixtures
import MusicLibrary.ReleaseGroupsFixtures import MusicLibrary.ReleaseGroupsFixtures
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
import Mox import Mox
alias MusicLibrary.Records.{Cover, Record} alias MusicLibrary.Records.{Cover, Record}
alias MusicBrainz.APIBehaviourMock alias MusicBrainz.APIBehaviourMock
@@ -51,8 +52,8 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|> assert_has("#records-#{record.id}") |> assert_has("#records-#{record.id}")
|> assert_has("#records-#{record.id} h2", text: escape(record.title)) |> assert_has("#records-#{record.id} h2", text: escape(record.title))
|> assert_has("#records-#{record.id} p", text: record.release) |> assert_has("#records-#{record.id} p", text: record.release)
|> assert_has("#records-#{record.id} p", text: Record.format_long_label(record.format)) |> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: Record.type_long_label(record.type)) |> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span", |> assert_has("#records-#{record.id} span",
text: Record.format_as_date(record.purchased_at) text: Record.format_as_date(record.purchased_at)
) )
@@ -136,8 +137,8 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|> assert_has("#records-#{record.id}") |> assert_has("#records-#{record.id}")
|> assert_has("#records-#{record.id} h2", text: escape(record.title)) |> assert_has("#records-#{record.id} h2", text: escape(record.title))
|> assert_has("#records-#{record.id} p", text: record.release) |> assert_has("#records-#{record.id} p", text: record.release)
|> assert_has("#records-#{record.id} p", text: Record.format_long_label(record.format)) |> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: Record.type_long_label(record.type)) |> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span", |> assert_has("#records-#{record.id} span",
text: Record.format_as_date(record.purchased_at) text: Record.format_as_date(record.purchased_at)
) )
@@ -178,8 +179,8 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|> assert_has("#records-#{record.id}") |> assert_has("#records-#{record.id}")
|> assert_has("#records-#{record.id} h2", text: escape(record.title)) |> assert_has("#records-#{record.id} h2", text: escape(record.title))
|> assert_has("#records-#{record.id} p", text: record.release) |> assert_has("#records-#{record.id} p", text: record.release)
|> assert_has("#records-#{record.id} p", text: Record.format_long_label(record.format)) |> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: Record.type_long_label(record.type)) |> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span", |> assert_has("#records-#{record.id} span",
text: Record.format_as_date(record.purchased_at) text: Record.format_as_date(record.purchased_at)
) )
@@ -2,6 +2,7 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
use MusicLibraryWeb.ConnCase use MusicLibraryWeb.ConnCase
import MusicLibrary.RecordsFixtures import MusicLibrary.RecordsFixtures
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.Records.Record alias MusicLibrary.Records.Record
describe "Edit record from show page" do describe "Edit record from show page" do
@@ -26,8 +27,8 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
|> visit(~p"/collection/#{record.id}") |> visit(~p"/collection/#{record.id}")
|> assert_has("h2", text: escape(record.title)) |> assert_has("h2", text: escape(record.title))
|> assert_has("p", text: record.release) |> assert_has("p", text: record.release)
|> assert_has("p", text: Record.format_long_label(record.format)) |> assert_has("p", text: format_label(record.format))
|> assert_has("p", text: Record.type_long_label(record.type)) |> assert_has("p", text: type_label(record.type))
|> assert_has("dd", text: Record.format_as_date(record.purchased_at)) |> assert_has("dd", text: Record.format_as_date(record.purchased_at))
|> assert_has("dd", text: record.id) |> assert_has("dd", text: record.id)
|> assert_has("a", text: record.musicbrainz_id) |> assert_has("a", text: record.musicbrainz_id)
@@ -2,8 +2,8 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
use MusicLibraryWeb.ConnCase use MusicLibraryWeb.ConnCase
alias MusicLibrary.{Records, Repo, Wishlist} alias MusicLibrary.{Records, Repo, Wishlist}
alias MusicLibrary.Records.Record
alias MusicBrainz.APIBehaviourMock alias MusicBrainz.APIBehaviourMock
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
import MusicLibrary.RecordsFixtures import MusicLibrary.RecordsFixtures
import MusicLibrary.ReleaseGroupsFixtures import MusicLibrary.ReleaseGroupsFixtures
import Mox import Mox
@@ -36,14 +36,14 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
|> Enum.frequencies_by(& &1.format) |> Enum.frequencies_by(& &1.format)
|> Enum.each(fn {format, count} -> |> Enum.each(fn {format, count} ->
assert_has(session, "a", text: to_string(count)) assert_has(session, "a", text: to_string(count))
assert_has(session, "dt", text: Record.format_long_label(format)) assert_has(session, "dt", text: format_label(format))
end) end)
collection collection
|> Enum.frequencies_by(& &1.type) |> Enum.frequencies_by(& &1.type)
|> Enum.each(fn {type, count} -> |> Enum.each(fn {type, count} ->
assert_has(session, "a", text: to_string(count)) assert_has(session, "a", text: to_string(count))
assert_has(session, "dt", text: Record.type_long_label(type)) assert_has(session, "dt", text: type_label(type))
end) end)
end end
@@ -2,6 +2,7 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
use MusicLibraryWeb.ConnCase use MusicLibraryWeb.ConnCase
import MusicLibrary.RecordsFixtures import MusicLibrary.RecordsFixtures
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.Records.Record alias MusicLibrary.Records.Record
describe "Edit record from show page" do describe "Edit record from show page" do
@@ -26,8 +27,8 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
|> visit(~p"/wishlist/#{record.id}") |> visit(~p"/wishlist/#{record.id}")
|> assert_has("h2", text: escape(record.title)) |> assert_has("h2", text: escape(record.title))
|> assert_has("p", text: record.release) |> assert_has("p", text: record.release)
|> assert_has("p", text: Record.format_long_label(record.format)) |> assert_has("p", text: format_label(record.format))
|> assert_has("p", text: Record.type_long_label(record.type)) |> assert_has("p", text: type_label(record.type))
|> assert_has("dd", text: record.id) |> assert_has("dd", text: record.id)
|> assert_has("a", text: record.musicbrainz_id) |> assert_has("a", text: record.musicbrainz_id)
|> assert_has("dd", text: Record.format_as_date(record.inserted_at)) |> assert_has("dd", text: Record.format_as_date(record.inserted_at))