From 7380d3da3c41ed6617b4c3447c4ccd6758adebf8 Mon Sep 17 00:00:00 2001 From: Vladimir Rubin Date: Thu, 12 Dec 2024 18:19:53 +0200 Subject: [PATCH] trans: switch to ngettext for "n days left" --- lib/exmr_web/live/exam_live/index.html.heex | 27 +++++++------- priv/gettext/default.pot | 40 +++++++++++---------- priv/gettext/en/LC_MESSAGES/default.po | 40 +++++++++++---------- priv/gettext/ru/LC_MESSAGES/default.po | 40 ++++++++++++--------- 4 files changed, 80 insertions(+), 67 deletions(-) diff --git a/lib/exmr_web/live/exam_live/index.html.heex b/lib/exmr_web/live/exam_live/index.html.heex index 4201d2e..6b9b2c7 100644 --- a/lib/exmr_web/live/exam_live/index.html.heex +++ b/lib/exmr_web/live/exam_live/index.html.heex @@ -1,19 +1,19 @@ <.header> - <%= gettext("Listing Exams") %> + {gettext("Listing Exams")}
|
<: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")} @@ -22,17 +22,16 @@
-
<%= exam.subject %>
+
{exam.subject}
- - <%= exam.date %> | + {exam.date} | - <%= 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}
@@ -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")}
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 767d0d5..53b473c 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -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 "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 440865d..ac311cc 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -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 "" diff --git a/priv/gettext/ru/LC_MESSAGES/default.po b/priv/gettext/ru/LC_MESSAGES/default.po index 41cf9cf..d79c99d 100644 --- a/priv/gettext/ru/LC_MESSAGES/default.po +++ b/priv/gettext/ru/LC_MESSAGES/default.po @@ -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 \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 "Завтра"