From b72a79c3806f163de31b930363c0168955649162 Mon Sep 17 00:00:00 2001 From: shibao Date: Mon, 30 Dec 2024 19:18:00 -0500 Subject: [PATCH] update gettext syntax --- changelog.md | 5 +++++ lib/memex/accounts/user.ex | 2 +- lib/memex/contexts/context.ex | 2 +- lib/memex/email.ex | 2 +- lib/memex/notes/note.ex | 2 +- lib/memex/pipelines/pipeline.ex | 2 +- lib/memex_web.ex | 7 ++++--- lib/memex_web/components/core_components.ex | 3 ++- lib/memex_web/controllers/error_json.ex | 2 +- lib/memex_web/controllers/user_auth.ex | 2 +- lib/memex_web/controllers/user_confirmation_controller.ex | 3 +-- lib/memex_web/controllers/user_registration_controller.ex | 2 +- lib/memex_web/controllers/user_settings_controller.ex | 2 +- lib/memex_web/gettext.ex | 4 ++-- mix.exs | 2 +- priv/gettext/de/LC_MESSAGES/default.po | 2 +- priv/gettext/de/LC_MESSAGES/errors.po | 2 +- priv/gettext/de/LC_MESSAGES/prompts.po | 4 ++-- priv/gettext/default.pot | 2 +- priv/gettext/en/LC_MESSAGES/default.po | 2 +- priv/gettext/en/LC_MESSAGES/errors.po | 2 +- priv/gettext/en/LC_MESSAGES/prompts.po | 4 ++-- priv/gettext/errors.pot | 2 +- priv/gettext/prompts.pot | 4 ++-- 24 files changed, 36 insertions(+), 30 deletions(-) diff --git a/changelog.md b/changelog.md index 88f2b0c..7ab6712 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# v0.1.17 +- Fix new invite button not working +- Fix some descriptions possibly overflowing widths +- Update dependencies + # v0.1.16 - Fix empty invite index page - Fix faq copy diff --git a/lib/memex/accounts/user.ex b/lib/memex/accounts/user.ex index 14d4d51..d96dadc 100644 --- a/lib/memex/accounts/user.ex +++ b/lib/memex/accounts/user.ex @@ -4,8 +4,8 @@ defmodule Memex.Accounts.User do """ use Ecto.Schema + use Gettext, backend: MemexWeb.Gettext import Ecto.Changeset - import MemexWeb.Gettext alias Ecto.{Association, Changeset, UUID} alias Memex.Accounts.{Invite, User} diff --git a/lib/memex/contexts/context.ex b/lib/memex/contexts/context.ex index 68a5301..9be4b1e 100644 --- a/lib/memex/contexts/context.ex +++ b/lib/memex/contexts/context.ex @@ -4,8 +4,8 @@ defmodule Memex.Contexts.Context do into a single consideration """ use Ecto.Schema + use Gettext, backend: MemexWeb.Gettext import Ecto.Changeset - import MemexWeb.Gettext alias Ecto.{Changeset, UUID} alias Memex.{Accounts.User, Repo} diff --git a/lib/memex/email.ex b/lib/memex/email.ex index 8984f74..5402b3c 100644 --- a/lib/memex/email.ex +++ b/lib/memex/email.ex @@ -7,8 +7,8 @@ defmodule Memex.Email do `lib/memex_web/components/layouts/email_text.txt.eex` for text emails. """ + use Gettext, backend: MemexWeb.Gettext import Swoosh.Email - import MemexWeb.Gettext import Phoenix.Template alias Memex.Accounts.User alias MemexWeb.{EmailHTML, Layouts} diff --git a/lib/memex/notes/note.ex b/lib/memex/notes/note.ex index d07f02f..2872e25 100644 --- a/lib/memex/notes/note.ex +++ b/lib/memex/notes/note.ex @@ -3,8 +3,8 @@ defmodule Memex.Notes.Note do Schema for a user-written note """ use Ecto.Schema + use Gettext, backend: MemexWeb.Gettext import Ecto.Changeset - import MemexWeb.Gettext alias Ecto.{Changeset, UUID} alias Memex.{Accounts.User, Repo} diff --git a/lib/memex/pipelines/pipeline.ex b/lib/memex/pipelines/pipeline.ex index c2d7422..93de712 100644 --- a/lib/memex/pipelines/pipeline.ex +++ b/lib/memex/pipelines/pipeline.ex @@ -3,8 +3,8 @@ defmodule Memex.Pipelines.Pipeline do Represents a chain of considerations to take to accomplish a task """ use Ecto.Schema + use Gettext, backend: MemexWeb.Gettext import Ecto.Changeset - import MemexWeb.Gettext alias Ecto.{Changeset, UUID} alias Memex.{Accounts.User, Pipelines.Steps.Step, Repo} diff --git a/lib/memex_web.ex b/lib/memex_web.ex index 9647b48..2e24f00 100644 --- a/lib/memex_web.ex +++ b/lib/memex_web.ex @@ -42,9 +42,9 @@ defmodule MemexWeb do formats: [:html, :json], layouts: [html: MemexWeb.Layouts] - # credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse + use Gettext, backend: MemexWeb.Gettext + import Plug.Conn - import MemexWeb.Gettext unquote(verified_routes()) end @@ -84,8 +84,9 @@ defmodule MemexWeb do defp html_helpers do quote do use PhoenixHTMLHelpers + use Gettext, backend: MemexWeb.Gettext import Phoenix.{Component, HTML, HTML.Form} - import MemexWeb.{ErrorHelpers, Gettext, CoreComponents, HTMLHelpers} + import MemexWeb.{ErrorHelpers, CoreComponents, HTMLHelpers} # Shortcut for generating JS commands alias Phoenix.LiveView.JS diff --git a/lib/memex_web/components/core_components.ex b/lib/memex_web/components/core_components.ex index 105ad89..2e87333 100644 --- a/lib/memex_web/components/core_components.ex +++ b/lib/memex_web/components/core_components.ex @@ -5,7 +5,8 @@ defmodule MemexWeb.CoreComponents do use PhoenixHTMLHelpers use Phoenix.Component use MemexWeb, :verified_routes - import MemexWeb.{Gettext, HTMLHelpers} + use Gettext, backend: MemexWeb.Gettext + import MemexWeb.HTMLHelpers alias Memex.{Accounts, Accounts.Invite, Accounts.User} alias Memex.Contexts.Context alias Memex.Notes.Note diff --git a/lib/memex_web/controllers/error_json.ex b/lib/memex_web/controllers/error_json.ex index 792e961..aa7447f 100644 --- a/lib/memex_web/controllers/error_json.ex +++ b/lib/memex_web/controllers/error_json.ex @@ -1,5 +1,5 @@ defmodule MemexWeb.ErrorJSON do - import MemexWeb.Gettext + use Gettext, backend: MemexWeb.Gettext def render(template, _assigns) do error_string = diff --git a/lib/memex_web/controllers/user_auth.ex b/lib/memex_web/controllers/user_auth.ex index 58afc13..eb0bf75 100644 --- a/lib/memex_web/controllers/user_auth.ex +++ b/lib/memex_web/controllers/user_auth.ex @@ -4,9 +4,9 @@ defmodule MemexWeb.UserAuth do """ use MemexWeb, :verified_routes + use Gettext, backend: MemexWeb.Gettext import Plug.Conn import Phoenix.Controller - import MemexWeb.Gettext alias Memex.{Accounts, Accounts.User} # Make the remember me cookie valid for 60 days. diff --git a/lib/memex_web/controllers/user_confirmation_controller.ex b/lib/memex_web/controllers/user_confirmation_controller.ex index dea3106..a3584fd 100644 --- a/lib/memex_web/controllers/user_confirmation_controller.ex +++ b/lib/memex_web/controllers/user_confirmation_controller.ex @@ -1,7 +1,6 @@ defmodule MemexWeb.UserConfirmationController do use MemexWeb, :controller - - import MemexWeb.Gettext + use Gettext, backend: MemexWeb.Gettext alias Memex.Accounts def new(conn, _params) do diff --git a/lib/memex_web/controllers/user_registration_controller.ex b/lib/memex_web/controllers/user_registration_controller.ex index 9d427a6..19617c2 100644 --- a/lib/memex_web/controllers/user_registration_controller.ex +++ b/lib/memex_web/controllers/user_registration_controller.ex @@ -1,6 +1,6 @@ defmodule MemexWeb.UserRegistrationController do use MemexWeb, :controller - import MemexWeb.Gettext + use Gettext, backend: MemexWeb.Gettext alias Ecto.Changeset alias Memex.{Accounts, Accounts.Invites} diff --git a/lib/memex_web/controllers/user_settings_controller.ex b/lib/memex_web/controllers/user_settings_controller.ex index 8d8977b..b9901f1 100644 --- a/lib/memex_web/controllers/user_settings_controller.ex +++ b/lib/memex_web/controllers/user_settings_controller.ex @@ -1,6 +1,6 @@ defmodule MemexWeb.UserSettingsController do use MemexWeb, :controller - import MemexWeb.Gettext + use Gettext, backend: MemexWeb.Gettext alias Memex.Accounts alias MemexWeb.UserAuth diff --git a/lib/memex_web/gettext.ex b/lib/memex_web/gettext.ex index 612b80d..4ed7ebe 100644 --- a/lib/memex_web/gettext.ex +++ b/lib/memex_web/gettext.ex @@ -5,7 +5,7 @@ defmodule MemexWeb.Gettext do By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: - import MemexWeb.Gettext + use Gettext, backend: MemexWeb.Gettext # Simple translation gettext("Here is the string to translate") @@ -20,5 +20,5 @@ defmodule MemexWeb.Gettext do See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ - use Gettext, otp_app: :memex + use Gettext.Backend, otp_app: :memex end diff --git a/mix.exs b/mix.exs index 84896bd..582346f 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Memex.MixProject do def project do [ app: :memex, - version: "0.1.16", + version: "0.1.17", elixir: "1.18.1", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po index 13d1c24..146816d 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -662,7 +662,7 @@ msgstr "" msgid "log out" msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:8 +#: lib/memex_web/controllers/user_confirmation_controller.ex:7 #, elixir-autogen, elixir-format, fuzzy msgid "confirm your account" msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/errors.po b/priv/gettext/de/LC_MESSAGES/errors.po index 22685ee..5de2c73 100644 --- a/priv/gettext/de/LC_MESSAGES/errors.po +++ b/priv/gettext/de/LC_MESSAGES/errors.po @@ -135,7 +135,7 @@ msgstr "" msgid "sorry, public registration is disabled" msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:53 +#: lib/memex_web/controllers/user_confirmation_controller.ex:52 #, elixir-autogen, elixir-format, fuzzy msgid "user confirmation link is invalid or it has expired." msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po index 8ccc681..93be6d4 100644 --- a/priv/gettext/de/LC_MESSAGES/prompts.po +++ b/priv/gettext/de/LC_MESSAGES/prompts.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Language: de\n" -#: lib/memex_web/controllers/user_confirmation_controller.ex:37 +#: lib/memex_web/controllers/user_confirmation_controller.ex:36 #, elixir-autogen, elixir-format msgid "%{email} confirmed successfully." msgstr "" @@ -142,7 +142,7 @@ msgstr "" msgid "saving..." msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:23 +#: lib/memex_web/controllers/user_confirmation_controller.ex:22 #, elixir-autogen, elixir-format, fuzzy msgid "if your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly." msgstr "" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 3b151b9..b3d5304 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -660,7 +660,7 @@ msgstr "" msgid "log out" msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:8 +#: lib/memex_web/controllers/user_confirmation_controller.ex:7 #, elixir-autogen, elixir-format msgid "confirm your account" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index e6cb121..2b350da 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -661,7 +661,7 @@ msgstr "" msgid "log out" msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:8 +#: lib/memex_web/controllers/user_confirmation_controller.ex:7 #, elixir-autogen, elixir-format, fuzzy msgid "confirm your account" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po index a336e9e..2af46e8 100644 --- a/priv/gettext/en/LC_MESSAGES/errors.po +++ b/priv/gettext/en/LC_MESSAGES/errors.po @@ -136,7 +136,7 @@ msgstr "" msgid "sorry, public registration is disabled" msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:53 +#: lib/memex_web/controllers/user_confirmation_controller.ex:52 #, elixir-autogen, elixir-format, fuzzy msgid "user confirmation link is invalid or it has expired." msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po index 2dcaea1..70dadba 100644 --- a/priv/gettext/en/LC_MESSAGES/prompts.po +++ b/priv/gettext/en/LC_MESSAGES/prompts.po @@ -11,7 +11,7 @@ msgstr "" "Language: en\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: lib/memex_web/controllers/user_confirmation_controller.ex:37 +#: lib/memex_web/controllers/user_confirmation_controller.ex:36 #, elixir-autogen, elixir-format msgid "%{email} confirmed successfully." msgstr "" @@ -143,7 +143,7 @@ msgstr "" msgid "saving..." msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:23 +#: lib/memex_web/controllers/user_confirmation_controller.ex:22 #, elixir-autogen, elixir-format, fuzzy msgid "if your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly." msgstr "" diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot index 23f62b2..8c3099c 100644 --- a/priv/gettext/errors.pot +++ b/priv/gettext/errors.pot @@ -135,7 +135,7 @@ msgstr "" msgid "sorry, public registration is disabled" msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:53 +#: lib/memex_web/controllers/user_confirmation_controller.ex:52 #, elixir-autogen, elixir-format msgid "user confirmation link is invalid or it has expired." msgstr "" diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index 6fa14fe..8394742 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -10,7 +10,7 @@ msgid "" msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:37 +#: lib/memex_web/controllers/user_confirmation_controller.ex:36 #, elixir-autogen, elixir-format msgid "%{email} confirmed successfully." msgstr "" @@ -142,7 +142,7 @@ msgstr "" msgid "saving..." msgstr "" -#: lib/memex_web/controllers/user_confirmation_controller.ex:23 +#: lib/memex_web/controllers/user_confirmation_controller.ex:22 #, elixir-autogen, elixir-format msgid "if your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly." msgstr ""