forked from shibao/cannery
gettext ammo groups
This commit is contained in:
parent
3675d0b4f4
commit
ac62afb313
@ -25,18 +25,20 @@ defmodule CanneryWeb.AmmoGroupLive.AmmoGroupCard do
|
||||
|
||||
<div class="flex flex-col justify-center items-center">
|
||||
<span class="rounded-lg title text-lg">
|
||||
Count: <%= @ammo_group.count %>
|
||||
<%= gettext("Count:") %>
|
||||
<%= @ammo_group.count %>
|
||||
</span>
|
||||
|
||||
<%= if @ammo_group.notes do %>
|
||||
<span class="rounded-lg title text-lg">
|
||||
Notes: <%= @ammo_group.notes %>
|
||||
<%= gettext("Notes:") %>
|
||||
<%= @ammo_group.notes %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<%= if @ammo_group.price_paid do %>
|
||||
<span class="rounded-lg title text-lg">
|
||||
Price paid: $ <%= @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2) %>
|
||||
<%= gettext("Price paid:") %> $ <%= @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2) %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -54,41 +54,41 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= label(f, :ammo_type_id, class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= label(f, :ammo_type_id, gettext("Ammo type"), class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= select(f, :ammo_type_id, ammo_type_options(@ammo_types),
|
||||
class: "text-center col-span-2 input input-primary"
|
||||
) %>
|
||||
<%= error_tag(f, :ammo_type_id, "col-span-3 text-center") %>
|
||||
|
||||
<%= label(f, :count, class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= label(f, :count, gettext("Count"), class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= number_input(f, :count,
|
||||
class: "text-center col-span-2 input input-primary",
|
||||
min: 1
|
||||
) %>
|
||||
<%= error_tag(f, :count, "col-span-3 text-center") %>
|
||||
|
||||
<%= label(f, :price_paid, class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= label(f, :price_paid, gettext("Price paid"), class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= number_input(f, :price_paid,
|
||||
step: "0.01",
|
||||
class: "text-center col-span-2 input input-primary"
|
||||
) %>
|
||||
<%= error_tag(f, :price_paid, "col-span-3 text-center") %>
|
||||
|
||||
<%= label(f, :notes, class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= label(f, :notes, gettext("Notes"), class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= textarea(f, :notes,
|
||||
class: "text-center col-span-2 input input-primary",
|
||||
phx_hook: "MaintainAttrs"
|
||||
) %>
|
||||
<%= error_tag(f, :notes, "col-span-3 text-center") %>
|
||||
|
||||
<%= label(f, :container, class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= label(f, :container, gettext("Container"), class: "mr-4 title text-lg text-primary-500") %>
|
||||
<%= select(f, :container_id, container_options(@containers),
|
||||
class: "text-center col-span-2 input input-primary"
|
||||
) %>
|
||||
<%= error_tag(f, :container_id, "col-span-3 text-center") %>
|
||||
|
||||
<%= submit("Save",
|
||||
phx_disable_with: "Saving...",
|
||||
<%= submit(dgettext("actions", "Save"),
|
||||
phx_disable_with: dgettext("prompts", "Saving..."),
|
||||
class: "mx-auto col-span-3 btn btn-primary"
|
||||
) %>
|
||||
</.form>
|
||||
@ -116,7 +116,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
||||
{:ok, _ammo_group} ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "Ammo group updated successfully")
|
||||
|> put_flash(:info, dgettext("prompts", "Ammo group updated successfully"))
|
||||
|> push_redirect(to: socket.assigns.return_to)}
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
@ -129,7 +129,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
|
||||
{:ok, _ammo_group} ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "Ammo group created successfully")
|
||||
|> put_flash(:info, dgettext("prompts", "Ammo group created successfully"))
|
||||
|> push_redirect(to: socket.assigns.return_to)}
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
|
@ -20,19 +20,19 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|
||||
|
||||
defp apply_action(socket, :edit, %{"id" => id}) do
|
||||
socket
|
||||
|> assign(:page_title, "Edit Ammo group")
|
||||
|> assign(:page_title, gettext("Edit Ammo group"))
|
||||
|> assign(:ammo_group, Ammo.get_ammo_group!(id))
|
||||
end
|
||||
|
||||
defp apply_action(socket, :new, _params) do
|
||||
socket
|
||||
|> assign(:page_title, "Add Ammo")
|
||||
|> assign(:page_title, dgettext("actions", "Add Ammo"))
|
||||
|> assign(:ammo_group, %AmmoGroup{})
|
||||
end
|
||||
|
||||
defp apply_action(socket, :index, _params) do
|
||||
socket
|
||||
|> assign(:page_title, "Listing Ammo groups")
|
||||
|> assign(:page_title, gettext("Listing Ammo groups"))
|
||||
|> assign(:ammo_group, nil)
|
||||
end
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
<div class="mx-8 flex flex-col space-y-8 justify-center items-center">
|
||||
<h1 class="title text-2xl title-primary-500">
|
||||
Listing Ammo
|
||||
<%= gettext("Listing Ammo") %>
|
||||
</h1>
|
||||
|
||||
<%= if @ammo_groups |> Enum.empty?() do %>
|
||||
<h2 class="title text-xl text-primary-500">
|
||||
No Ammo 😔
|
||||
<%= gettext("No Ammo") %> 😔
|
||||
</h2>
|
||||
|
||||
<%= live_patch("Add your first box!",
|
||||
<%= live_patch(dgettext("actions", "Add your first box!"),
|
||||
to: Routes.ammo_group_index_path(@socket, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<% else %>
|
||||
<%= live_patch("New Ammo group",
|
||||
<%= live_patch(dgettext("actions", "New Ammo group"),
|
||||
to: Routes.ammo_group_index_path(@socket, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
@ -23,13 +23,13 @@
|
||||
<thead class="border-b border-primary-600">
|
||||
<tr>
|
||||
<th class="p-2">
|
||||
Count
|
||||
<%= gettext("Count") %>
|
||||
</th>
|
||||
<th class="p-2">
|
||||
Price paid
|
||||
<%= gettext("Price paid") %>
|
||||
</th>
|
||||
<th class="p-2">
|
||||
Notes
|
||||
<%= gettext("Notes") %>
|
||||
</th>
|
||||
|
||||
<th class="p-2"></th>
|
||||
@ -53,7 +53,9 @@
|
||||
</td>
|
||||
|
||||
<td class="p-2 w-full h-full space-x-2 flex justify-center items-center">
|
||||
<%= live_redirect("View", to: Routes.ammo_group_show_path(@socket, :show, ammo_group)) %>
|
||||
<%= live_redirect(dgettext("actions", "View"),
|
||||
to: Routes.ammo_group_show_path(@socket, :show, ammo_group)
|
||||
) %>
|
||||
|
||||
<%= live_patch to: Routes.ammo_group_index_path(@socket, :edit, ammo_group),
|
||||
class: "text-primary-500 link" do %>
|
||||
@ -64,7 +66,7 @@
|
||||
class: "text-primary-500 link",
|
||||
phx_click: "delete",
|
||||
phx_value_id: ammo_group.id,
|
||||
data: [confirm: "Are you sure you want to delete this ammo?"] do %>
|
||||
data: [confirm: dgettext("prompts", "Are you sure you want to delete this ammo?")] do %>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</td>
|
||||
|
@ -32,6 +32,6 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
|
||||
{:noreply, socket |> push_redirect(to: Routes.ammo_group_index_path(socket, :index))}
|
||||
end
|
||||
|
||||
defp page_title(:show), do: "Show Ammo group"
|
||||
defp page_title(:edit), do: "Edit Ammo group"
|
||||
defp page_title(:show), do: gettext("Show Ammo group")
|
||||
defp page_title(:edit), do: gettext("Edit Ammo group")
|
||||
end
|
||||
|
@ -5,18 +5,20 @@
|
||||
|
||||
<div class="space-y-2 flex flex-col justify-center items-center">
|
||||
<span class="rounded-lg title text-lg">
|
||||
Count: <%= @ammo_group.count %>
|
||||
<%= gettext("Count:") %>
|
||||
<%= @ammo_group.count %>
|
||||
</span>
|
||||
|
||||
<%= if @ammo_group.notes do %>
|
||||
<span class="rounded-lg title text-lg">
|
||||
Notes: <%= @ammo_group.notes %>
|
||||
<%= gettext("Notes:") %>
|
||||
<%= @ammo_group.notes %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<%= if @ammo_group.price_paid do %>
|
||||
<span class="rounded-lg title text-lg">
|
||||
Price paid: $ <%= @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2) %>
|
||||
<%= gettext("Price paid:") %> $ <%= @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2) %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
@ -30,7 +32,7 @@
|
||||
<%= link to: "#",
|
||||
class: "text-primary-500 link",
|
||||
phx_click: "delete",
|
||||
data: [confirm: "Are you sure you want to delete this ammo?"] do %>
|
||||
data: [confirm: dgettext("prompts", "Are you sure you want to delete this ammo?")] do %>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</div>
|
||||
@ -40,12 +42,12 @@
|
||||
<div>
|
||||
<%= if @ammo_group.container do %>
|
||||
<h1 class="mb-4 px-4 py-2 text-center rounded-lg title text-xl">
|
||||
Stored in
|
||||
<%= gettext("Stored in") %>
|
||||
</h1>
|
||||
|
||||
<.container_card container={@ammo_group.container} />
|
||||
<% else %>
|
||||
This ammo group is not in a container
|
||||
<%= gettext("This ammo group is not in a container") %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -74,3 +74,28 @@ msgstr ""
|
||||
#: lib/cannery_web/templates/user_reset_password/new.html.heex:16
|
||||
msgid "Send instructions to reset password"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.ex:29
|
||||
msgid "Add Ammo"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:11
|
||||
msgid "Add your first box!"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:16
|
||||
msgid "New Ammo group"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:90
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:56
|
||||
msgid "View"
|
||||
msgstr ""
|
||||
|
@ -109,3 +109,72 @@ msgstr ""
|
||||
#: lib/cannery_web/templates/user_settings/edit.html.heex:3
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:26
|
||||
msgid "Count"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/ammo_group_card.ex:28
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:8
|
||||
msgid "Count:"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.ex:23
|
||||
#: lib/cannery_web/live/ammo_group_live/show.ex:36
|
||||
msgid "Edit Ammo group"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3
|
||||
msgid "Listing Ammo"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.ex:35
|
||||
msgid "Listing Ammo groups"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:8
|
||||
msgid "No Ammo"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:32
|
||||
msgid "Notes"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/ammo_group_card.ex:34
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:14
|
||||
msgid "Notes:"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:29
|
||||
msgid "Price paid"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/ammo_group_card.ex:41
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:21
|
||||
msgid "Price paid:"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/show.ex:35
|
||||
msgid "Show Ammo group"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:45
|
||||
msgid "Stored in"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:50
|
||||
msgid "This ammo group is not in a container"
|
||||
msgstr ""
|
||||
|
@ -75,3 +75,24 @@ msgstr ""
|
||||
#: lib/cannery_web/controllers/user_settings_controller.ex:78
|
||||
msgid "Your account has been deleted"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:132
|
||||
msgid "Ammo group created successfully"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:119
|
||||
msgid "Ammo group updated successfully"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/index.html.heex:69
|
||||
#: lib/cannery_web/live/ammo_group_live/show.html.heex:35
|
||||
msgid "Are you sure you want to delete this ammo?"
|
||||
msgstr ""
|
||||
|
||||
#, elixir-format, ex-autogen
|
||||
#: lib/cannery_web/live/ammo_group_live/form_component.ex:91
|
||||
msgid "Saving..."
|
||||
msgstr ""
|
||||
|
Loading…
Reference in New Issue
Block a user