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

View file

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