trans: switch to ngettext for "n days left"
Some checks failed
Checks / check (pull_request) Failing after -6m14s

This commit is contained in:
Vladimir Rubin 2024-12-12 18:19:53 +02:00
parent a5df93e4b7
commit 7380d3da3c
Signed by: vavakado
GPG key ID: CAB744727F36B524
4 changed files with 80 additions and 67 deletions

View file

@ -1,19 +1,19 @@
<.header>
<%= gettext("Listing Exams") %>
{gettext("Listing Exams")}
<div>
<button phx-click="sort" phx-value-by="subject" class="font-light">
<%= gettext("Sort by Subject") %>
{gettext("Sort by Subject")}
</button>
<a>|</a>
<button phx-click="sort" phx-value-by="date" class="font-light">
<%= gettext("Sort by Date") %>
{gettext("Sort by Date")}
</button>
</div>
<:actions>
<.link patch={~p"/exams/new"}>
<.button class="dark:bg-sky-300 text-white dark:text-black/80 dark:hover:bg-sky-400">
<%= gettext("New Exam") %>
{gettext("New Exam")}
</.button>
</.link>
</:actions>
@ -22,17 +22,16 @@
<div class="divide-y">
<div :for={exam <- @exams} class="py-2 flex gap-2">
<div class="grow">
<div class="font-bold"><%= exam.subject %></div>
<div class="font-bold">{exam.subject}</div>
<div class="font-sm">
<!-- TODO: change to use ngettext -->
<%= exam.date %> |
{exam.date} |
<b>
<%= case Date.diff(exam.date, Date.utc_today()) do
{case Date.diff(exam.date, Date.utc_today()) do
0 -> gettext("Today")
1 -> gettext("Tomorrow")
x when x > 1 -> "#{x} #{gettext("days left")}"
x when x < 0 -> "#{x * -1} #{gettext("days passed")}"
end %>
1 -> gettext("Tommorow")
x when x > 1 -> ngettext("Tomorrow", "%{count} days left", x)
x when x < 0 -> ngettext("Yesterday", "%{count} days passed", x * -1)
end}
</b>
</div>
</div>
@ -41,14 +40,14 @@
phx-value-id={exam.id}
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-3 rounded-md"
>
<%= gettext("Edit") %>
{gettext("Edit")}
</button>
<button
phx-click="remove"
phx-value-id={exam.id}
class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 rounded-md"
>
<%= gettext("Remove") %>
{gettext("Remove")}
</button>
</div>
</div>

View file

@ -31,7 +31,7 @@ msgstr ""
msgid "Built using Phoenix LiveView, Ecto, and TailwindCSS by @vavakado"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:39
#: lib/exmr_web/live/exam_live/index.html.heex:44
#, elixir-autogen, elixir-format
msgid "Edit"
msgstr ""
@ -52,12 +52,12 @@ msgid "Hang in there while we get back on track"
msgstr ""
#: lib/exmr_web/live/exam_live/index.ex:32
#: lib/exmr_web/live/exam_live/index.html.heex:12
#: lib/exmr_web/live/exam_live/index.html.heex:16
#, elixir-autogen, elixir-format
msgid "New Exam"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:46
#: lib/exmr_web/live/exam_live/index.html.heex:51
#, elixir-autogen, elixir-format
msgid "Remove"
msgstr ""
@ -67,12 +67,12 @@ msgstr ""
msgid "Something went wrong!"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:7
#: lib/exmr_web/live/exam_live/index.html.heex:10
#, elixir-autogen, elixir-format
msgid "Sort by Date"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:4
#: lib/exmr_web/live/exam_live/index.html.heex:5
#, elixir-autogen, elixir-format
msgid "Sort by Subject"
msgstr ""
@ -82,15 +82,17 @@ msgstr ""
msgid "Success!"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:26
#: lib/exmr_web/live/exam_live/index.html.heex:31
#, elixir-autogen, elixir-format
msgid "Today"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:27
#: lib/exmr_web/live/exam_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Tomorrow"
msgstr ""
msgid_plural "%{count} days left"
msgstr[0] ""
msgstr[1] ""
#: lib/exmr_web/components/core_components.ex:159
#, elixir-autogen, elixir-format
@ -103,16 +105,6 @@ msgstr ""
msgid "close"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:28
#, elixir-autogen, elixir-format
msgid "days left"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:29
#, elixir-autogen, elixir-format
msgid "days passed"
msgstr ""
#: lib/exmr_web/live/user_settings_live.ex:139
#, elixir-autogen, elixir-format
msgid "A link to confirm your email change has been sent to the new address."
@ -219,3 +211,15 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Saving..."
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:34
#, elixir-autogen, elixir-format
msgid "Yesterday"
msgid_plural "%{count} days passed"
msgstr[0] ""
msgstr[1] ""
#: lib/exmr_web/live/exam_live/index.html.heex:32
#, elixir-autogen, elixir-format
msgid "Tommorow"
msgstr ""

View file

@ -31,7 +31,7 @@ msgstr ""
msgid "Built using Phoenix LiveView, Ecto, and TailwindCSS by @vavakado"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:39
#: lib/exmr_web/live/exam_live/index.html.heex:44
#, elixir-autogen, elixir-format
msgid "Edit"
msgstr ""
@ -52,12 +52,12 @@ msgid "Hang in there while we get back on track"
msgstr ""
#: lib/exmr_web/live/exam_live/index.ex:32
#: lib/exmr_web/live/exam_live/index.html.heex:12
#: lib/exmr_web/live/exam_live/index.html.heex:16
#, elixir-autogen, elixir-format
msgid "New Exam"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:46
#: lib/exmr_web/live/exam_live/index.html.heex:51
#, elixir-autogen, elixir-format
msgid "Remove"
msgstr ""
@ -67,12 +67,12 @@ msgstr ""
msgid "Something went wrong!"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:7
#: lib/exmr_web/live/exam_live/index.html.heex:10
#, elixir-autogen, elixir-format
msgid "Sort by Date"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:4
#: lib/exmr_web/live/exam_live/index.html.heex:5
#, elixir-autogen, elixir-format
msgid "Sort by Subject"
msgstr ""
@ -82,15 +82,17 @@ msgstr ""
msgid "Success!"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:26
#: lib/exmr_web/live/exam_live/index.html.heex:31
#, elixir-autogen, elixir-format
msgid "Today"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:27
#: lib/exmr_web/live/exam_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Tomorrow"
msgstr ""
msgid_plural "%{count} days left"
msgstr[0] ""
msgstr[1] ""
#: lib/exmr_web/components/core_components.ex:159
#, elixir-autogen, elixir-format
@ -103,16 +105,6 @@ msgstr ""
msgid "close"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:28
#, elixir-autogen, elixir-format
msgid "days left"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:29
#, elixir-autogen, elixir-format
msgid "days passed"
msgstr ""
#: lib/exmr_web/live/user_settings_live.ex:139
#, elixir-autogen, elixir-format
msgid "A link to confirm your email change has been sent to the new address."
@ -219,3 +211,15 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Saving..."
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:34
#, elixir-autogen, elixir-format
msgid "Yesterday"
msgid_plural "%{count} days passed"
msgstr[0] ""
msgstr[1] ""
#: lib/exmr_web/live/exam_live/index.html.heex:32
#, elixir-autogen, elixir-format, fuzzy
msgid "Tommorow"
msgstr ""

View file

@ -13,7 +13,7 @@ msgid ""
msgstr ""
"Project-Id-Version: unnamed project\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2024-12-11 22:16+0200\n"
"PO-Revision-Date: 2024-12-12 18:19+0200\n"
"Last-Translator: Vladimir Rubin <vavakado@proton.me>\n"
"Language-Team: Russian\n"
"Language: ru\n"
@ -42,7 +42,7 @@ msgstr ""
"Создано с использованием Phoenix LiveView, Ecto и TailwindCSS в исполнении "
"@vavakado"
#: lib/exmr_web/live/exam_live/index.html.heex:39
#: lib/exmr_web/live/exam_live/index.html.heex:44
msgid "Edit"
msgstr "Изменить"
@ -59,11 +59,11 @@ msgid "Hang in there while we get back on track"
msgstr "Держитесь, пока мы не вернемся в строй"
#: lib/exmr_web/live/exam_live/index.ex:32
#: lib/exmr_web/live/exam_live/index.html.heex:12
#: lib/exmr_web/live/exam_live/index.html.heex:16
msgid "New Exam"
msgstr "Новый экзамен"
#: lib/exmr_web/live/exam_live/index.html.heex:46
#: lib/exmr_web/live/exam_live/index.html.heex:51
msgid "Remove"
msgstr "Удалить"
@ -71,11 +71,11 @@ msgstr "Удалить"
msgid "Something went wrong!"
msgstr "Что-то пошло не так!"
#: lib/exmr_web/live/exam_live/index.html.heex:7
#: lib/exmr_web/live/exam_live/index.html.heex:10
msgid "Sort by Date"
msgstr "Сортировать по дате"
#: lib/exmr_web/live/exam_live/index.html.heex:4
#: lib/exmr_web/live/exam_live/index.html.heex:5
msgid "Sort by Subject"
msgstr "Сортировать по предмету"
@ -83,13 +83,16 @@ msgstr "Сортировать по предмету"
msgid "Success!"
msgstr "Успех!"
#: lib/exmr_web/live/exam_live/index.html.heex:26
#: lib/exmr_web/live/exam_live/index.html.heex:31
msgid "Today"
msgstr "Сегодня"
#: lib/exmr_web/live/exam_live/index.html.heex:27
#: lib/exmr_web/live/exam_live/index.html.heex:33
msgid "Tomorrow"
msgstr "Завтра"
msgid_plural "%{count} days left"
msgstr[0] "%{count} день остался"
msgstr[1] "%{count} дня осталось"
msgstr[2] "%{count} дней осталось"
#: lib/exmr_web/components/core_components.ex:159
msgid "We can't find the internet"
@ -100,14 +103,6 @@ msgstr "Мы не можем найти интернет"
msgid "close"
msgstr "закрыть"
#: lib/exmr_web/live/exam_live/index.html.heex:28
msgid "days left"
msgstr "дней осталось"
#: lib/exmr_web/live/exam_live/index.html.heex:29
msgid "days passed"
msgstr "дней прошло"
#: lib/exmr_web/live/user_settings_live.ex:139
msgid "A link to confirm your email change has been sent to the new address."
msgstr ""
@ -198,3 +193,14 @@ msgstr "Сохранить экзамен"
#: lib/exmr_web/live/exam_live/form_component.ex:28
msgid "Saving..."
msgstr "Сохранение..."
#: lib/exmr_web/live/exam_live/index.html.heex:34
msgid "Yesterday"
msgid_plural "%{count} days passed"
msgstr[0] "%{count} день прошёл"
msgstr[1] "%{count} дня прошло"
msgstr[2] "%{count} дней прошло"
#: lib/exmr_web/live/exam_live/index.html.heex:32
msgid "Tommorow"
msgstr "Завтра"