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 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(release) do
@@ -49,9 +49,7 @@ defmodule MusicLibraryWeb.RecordComponents do
</span>
</p>
<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(
record.type
)}
{format_label(record.format)} · {type_label(record.type)}
<span :if={Records.Record.child_release_groups_count(record) > 0}>
·
<span class="sr-only">
@@ -78,9 +76,7 @@ defmodule MusicLibraryWeb.RecordComponents do
<div class="flex shrink-0 items-center gap-x-6">
<div class="hidden sm:flex sm:flex-col sm:items-end">
<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(
record.type
)}
{format_label(record.format)} · {type_label(record.type)}
<span :if={Records.Record.child_release_groups_count(record) > 0}>
·
<span class="sr-only">
@@ -213,6 +209,20 @@ defmodule MusicLibraryWeb.RecordComponents do
"""
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
JS.toggle(to: "#actions-#{record_id}")
|> JS.toggle_class("pointer-events-none", to: "#records > li")
@@ -1,6 +1,7 @@
defmodule MusicLibraryWeb.ArtistLive.RecordComponents do
use MusicLibraryWeb, :live_component
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.Records
attr :records, :list, required: true
@@ -46,9 +47,7 @@ defmodule MusicLibraryWeb.ArtistLive.RecordComponents do
{record.title}
</p>
<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(
record.type
)}
{format_label(record.format)} · {type_label(record.type)}
</p>
<p class="pointer-events-none block text-sm font-medium text-zinc-500">
{Records.Record.format_release(record.release)}
@@ -1,7 +1,9 @@
defmodule MusicLibraryWeb.CollectionLive.Show do
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 MusicLibrary.Records
@@ -22,9 +22,9 @@
{@record.title}
</h2>
<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(
@record.format
)} · {Records.Record.type_long_label(@record.type)}
{Records.Record.format_release(@record.release)} · {format_label(@record.format)} · {type_label(
@record.type
)}
</p>
</div>
<div class="relative flex-none">
@@ -1,6 +1,7 @@
defmodule MusicLibraryWeb.RecordLive.FormComponent do
use MusicLibraryWeb, :live_component
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.Records
alias MusicLibrary.Records.Cover
@@ -37,14 +38,14 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
type="select"
label={gettext("Type")}
prompt={gettext("Choose a value")}
options={Records.Record.types_with_labels()}
options={types_with_labels()}
/>
<.input
field={@form[:format]}
type="select"
label={gettext("Format")}
prompt={gettext("Choose a value")}
options={Records.Record.formats_with_labels()}
options={formats_with_labels()}
/>
</div>
<.input field={@form[:musicbrainz_id]} type="text" label={gettext("MusicBrainz ID")} />
@@ -132,5 +133,13 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
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})
end
@@ -1,7 +1,9 @@
defmodule MusicLibraryWeb.RecordLive.ImportComponent do
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
@impl true
@@ -68,9 +70,7 @@ defmodule MusicLibraryWeb.RecordLive.ImportComponent do
{@release_group.title}
</h2>
<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(
@release_group.type
)}
{Records.Record.format_release(@release_group.release)} · {type_label(@release_group.type)}
</p>
</div>
<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)
}
>
{Records.Record.format_long_label(format)}
{format_label(format)}
</.link>
</.focus_wrap>
</div>
@@ -2,9 +2,9 @@ defmodule MusicLibraryWeb.StatsLive.Index do
use MusicLibraryWeb, :live_view
import MusicLibraryWeb.StatsLive.DataComponents
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.{Artists, Collection, Records, Wishlist}
alias Records.Record
def mount(_params, _session, socket) do
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">
<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>
<dd class="mt-1 text-center">
<.link
@@ -54,7 +54,7 @@
]}>
<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">
{Record.type_long_label(type)}
{type_label(type)}
</dt>
<dd class="mt-1 text-center">
<.link
@@ -202,7 +202,7 @@
)
}
>
{Records.Record.format_long_label(format)}
{format_label(format)}
</.link>
</.focus_wrap>
</div>
@@ -1,7 +1,9 @@
defmodule MusicLibraryWeb.WishlistLive.Show do
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
@impl true
@@ -26,9 +26,7 @@
<span :if={@current_date && !Records.Record.released?(@record, @current_date)}>
({gettext("Unreleased")})
</span>
· {Records.Record.format_long_label(@record.format)} · {Records.Record.type_long_label(
@record.type
)}
· {format_label(@record.format)} · {type_label(@record.type)}
</p>
</div>
<div class="relative flex-none">
+129 -69
View File
@@ -16,15 +16,15 @@ msgstr ""
msgid "Actions"
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/wishlist_live/show.html.heex:148
#: lib/music_library_web/live/wishlist_live/show.html.heex:146
#, elixir-autogen, elixir-format
msgid "Are you sure?"
msgstr ""
#: lib/music_library_web/live/record_live/form_component.ex:39
#: lib/music_library_web/live/record_live/form_component.ex:46
#: lib/music_library_web/live/record_live/form_component.ex:40
#: lib/music_library_web/live/record_live/form_component.ex:47
#, elixir-autogen, elixir-format
msgid "Choose a value"
msgstr ""
@@ -32,29 +32,29 @@ msgstr ""
#: 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/collection_live/index.ex:143
#: lib/music_library_web/live/collection_live/show.ex:115
#: lib/music_library_web/live/collection_live/show.ex:132
#: lib/music_library_web/live/collection_live/show.ex:117
#: lib/music_library_web/live/collection_live/show.ex:134
#, elixir-autogen, elixir-format
msgid "Collection"
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
msgid "Cover art"
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/wishlist_live/show.html.heex:156
#: lib/music_library_web/live/wishlist_live/show.html.heex:154
#, elixir-autogen, elixir-format
msgid "Delete"
msgstr ""
#: lib/music_library_web/components/record_components.ex:165
#: lib/music_library_web/live/collection_live/show.ex:139
#: lib/music_library_web/components/record_components.ex:161
#: 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/wishlist_live/show.ex:142
#: lib/music_library_web/live/wishlist_live/show.html.heex:74
#: lib/music_library_web/live/wishlist_live/show.ex:144
#: lib/music_library_web/live/wishlist_live/show.html.heex:72
#, elixir-autogen, elixir-format
msgid "Edit"
msgstr ""
@@ -74,7 +74,7 @@ msgstr ""
msgid "Error!"
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
msgid "Format"
msgstr ""
@@ -85,7 +85,7 @@ msgid "Formats"
msgstr ""
#: 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
msgid "Genres"
msgstr ""
@@ -102,7 +102,7 @@ msgid "Import"
msgstr ""
#: 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
msgid "Inserted at"
msgstr ""
@@ -129,8 +129,8 @@ msgid "Logout"
msgstr ""
#: 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/wishlist_live/show.html.heex:201
#: lib/music_library_web/live/record_live/form_component.ex:51
#: lib/music_library_web/live/wishlist_live/show.html.heex:199
#, elixir-autogen, elixir-format
msgid "MusicBrainz ID"
msgstr ""
@@ -141,19 +141,19 @@ msgstr ""
msgid "Next"
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
msgid "No cover selected"
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
msgid "No results"
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/wishlist_live/show.html.heex:42
#: lib/music_library_web/live/wishlist_live/show.html.heex:40
#, elixir-autogen, elixir-format
msgid "Open options"
msgstr ""
@@ -169,20 +169,20 @@ msgstr ""
msgid "Previous"
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/wishlist_live/show.html.heex:139
#: lib/music_library_web/live/wishlist_live/show.html.heex:137
#, elixir-autogen, elixir-format
msgid "Purchase"
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
msgid "Purchased at"
msgstr ""
#: lib/music_library_web/components/record_components.ex:65
#: lib/music_library_web/components/record_components.ex:94
#: lib/music_library_web/components/record_components.ex:63
#: lib/music_library_web/components/record_components.ex:90
#: lib/music_library_web/live/collection_live/show.html.heex:201
#, elixir-autogen, elixir-format
msgid "Purchased on"
@@ -195,46 +195,46 @@ msgstr ""
msgid "Record imported successfully"
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/show.ex:111
#: lib/music_library_web/live/wishlist_live/show.ex:113
#, elixir-autogen, elixir-format
msgid "Record updated successfully"
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
msgid "Release"
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
msgid "Save"
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
msgid "Saving..."
msgstr ""
#: lib/music_library_web/components/record_components.ex:207
#: lib/music_library_web/components/record_components.ex:203
#, elixir-autogen, elixir-format
msgid "Search"
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
msgid "Search for a record on MusicBrainz"
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
msgid "Search for records"
msgstr ""
#: lib/music_library_web/components/record_components.ex:145
#: lib/music_library_web/live/collection_live/show.ex:138
#: lib/music_library_web/live/wishlist_live/show.ex:141
#: lib/music_library_web/components/record_components.ex:141
#: lib/music_library_web/live/collection_live/show.ex:140
#: lib/music_library_web/live/wishlist_live/show.ex:143
#, elixir-autogen, elixir-format
msgid "Show"
msgstr ""
@@ -262,9 +262,9 @@ msgid "Success!"
msgstr ""
#: 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/show.ex:11
#: lib/music_library_web/live/wishlist_live/show.ex:13
#, elixir-autogen, elixir-format
msgid "The application has been updated, please reload."
msgstr ""
@@ -279,7 +279,7 @@ msgstr ""
msgid "Total wishlist"
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
msgid "Type"
msgstr ""
@@ -290,12 +290,12 @@ msgid "Types"
msgstr ""
#: 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
msgid "Updated at"
msgstr ""
#: lib/music_library_web/components/record_components.ex:155
#: lib/music_library_web/components/record_components.ex:151
#, elixir-autogen, elixir-format
msgid "View on MusicBrainz"
msgstr ""
@@ -308,7 +308,7 @@ msgstr ""
#: 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/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
msgid "Wishlist"
msgstr ""
@@ -325,13 +325,13 @@ msgid "close"
msgstr ""
#: 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
msgid "Copy MusicBrainz ID to clipboard"
msgstr ""
#: 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
msgid "MusicBrainz data"
msgstr ""
@@ -357,26 +357,26 @@ msgstr ""
msgid "Wishlisted"
msgstr ""
#: lib/music_library_web/components/record_components.ex:58
#: lib/music_library_web/components/record_components.ex:87
#: lib/music_library_web/components/record_components.ex:56
#: lib/music_library_web/components/record_components.ex:83
#, elixir-autogen, elixir-format
msgid "Number of included records"
msgstr ""
#: 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
msgid "Includes"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:54
#: lib/music_library_web/live/wishlist_live/show.ex:58
#: lib/music_library_web/live/collection_live/show.ex:56
#: lib/music_library_web/live/wishlist_live/show.ex:60
#, elixir-autogen, elixir-format
msgid "Error refreshing MusicBrainz data"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:46
#: lib/music_library_web/live/wishlist_live/show.ex:50
#: lib/music_library_web/live/collection_live/show.ex:48
#: lib/music_library_web/live/wishlist_live/show.ex:52
#, elixir-autogen, elixir-format
msgid "MusicBrainz data refreshed successfully"
msgstr ""
@@ -386,18 +386,18 @@ msgstr ""
msgid "Refresh LastFm Feed"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:86
#: lib/music_library_web/live/wishlist_live/show.ex:70
#: lib/music_library_web/live/collection_live/show.ex:88
#: lib/music_library_web/live/wishlist_live/show.ex:72
#, elixir-autogen, elixir-format
msgid "Cover refreshed successfully"
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
msgid "Error refreshing Cover"
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
msgid "Error refreshing cover"
msgstr ""
@@ -408,7 +408,7 @@ msgid "No MB ID"
msgstr ""
#: 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
msgid "Details"
msgstr ""
@@ -433,7 +433,7 @@ msgstr ""
msgid "Dev dashboard"
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
msgid "View details"
msgstr ""
@@ -453,32 +453,32 @@ msgstr ""
msgid "Loading play count"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:74
#: lib/music_library_web/live/wishlist_live/show.ex:98
#: lib/music_library_web/live/collection_live/show.ex:76
#: lib/music_library_web/live/wishlist_live/show.ex:100
#, elixir-autogen, elixir-format
msgid "Error populating genres"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex:66
#: lib/music_library_web/live/wishlist_live/show.ex:90
#: lib/music_library_web/live/collection_live/show.ex:68
#: lib/music_library_web/live/wishlist_live/show.ex:92
#, elixir-autogen, elixir-format
msgid "Genres populated successfully"
msgstr ""
#: 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
msgid "Populate genres"
msgstr ""
#: 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
msgid "Refresh MB data"
msgstr ""
#: 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
msgid "Refresh cover"
msgstr ""
@@ -513,7 +513,7 @@ msgstr ""
msgid "On Tour"
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
msgid "1 record"
msgid_plural "%{count} records"
@@ -528,13 +528,13 @@ msgstr[0] ""
msgstr[1] ""
#: 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
msgid "Copy record ID to clipboard"
msgstr ""
#: 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
msgid "ID"
msgstr ""
@@ -544,3 +544,63 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Unreleased"
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.ReleaseGroupsFixtures
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
import Mox
alias MusicLibrary.Records.{Cover, Record}
alias MusicBrainz.APIBehaviourMock
@@ -51,8 +52,8 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|> assert_has("#records-#{record.id}")
|> 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.format_long_label(record.format))
|> assert_has("#records-#{record.id} p", text: Record.type_long_label(record.type))
|> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span",
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} h2", text: escape(record.title))
|> 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: Record.type_long_label(record.type))
|> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span",
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} h2", text: escape(record.title))
|> 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: Record.type_long_label(record.type))
|> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span",
text: Record.format_as_date(record.purchased_at)
)
@@ -2,6 +2,7 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
use MusicLibraryWeb.ConnCase
import MusicLibrary.RecordsFixtures
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.Records.Record
describe "Edit record from show page" do
@@ -26,8 +27,8 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
|> visit(~p"/collection/#{record.id}")
|> assert_has("h2", text: escape(record.title))
|> assert_has("p", text: record.release)
|> assert_has("p", text: Record.format_long_label(record.format))
|> assert_has("p", text: Record.type_long_label(record.type))
|> assert_has("p", text: format_label(record.format))
|> assert_has("p", text: type_label(record.type))
|> assert_has("dd", text: Record.format_as_date(record.purchased_at))
|> assert_has("dd", text: record.id)
|> assert_has("a", text: record.musicbrainz_id)
@@ -2,8 +2,8 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
use MusicLibraryWeb.ConnCase
alias MusicLibrary.{Records, Repo, Wishlist}
alias MusicLibrary.Records.Record
alias MusicBrainz.APIBehaviourMock
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
import MusicLibrary.RecordsFixtures
import MusicLibrary.ReleaseGroupsFixtures
import Mox
@@ -36,14 +36,14 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
|> Enum.frequencies_by(& &1.format)
|> Enum.each(fn {format, 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)
collection
|> Enum.frequencies_by(& &1.type)
|> Enum.each(fn {type, 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
@@ -2,6 +2,7 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
use MusicLibraryWeb.ConnCase
import MusicLibrary.RecordsFixtures
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.Records.Record
describe "Edit record from show page" do
@@ -26,8 +27,8 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
|> visit(~p"/wishlist/#{record.id}")
|> assert_has("h2", text: escape(record.title))
|> assert_has("p", text: record.release)
|> assert_has("p", text: Record.format_long_label(record.format))
|> assert_has("p", text: Record.type_long_label(record.type))
|> assert_has("p", text: format_label(record.format))
|> assert_has("p", text: type_label(record.type))
|> assert_has("dd", text: record.id)
|> assert_has("a", text: record.musicbrainz_id)
|> assert_has("dd", text: Record.format_as_date(record.inserted_at))