update gettext syntax

This commit is contained in:
shibao 2024-12-30 19:18:00 -05:00
parent 5cd7a7eef0
commit b72a79c380
24 changed files with 36 additions and 30 deletions

View File

@ -1,3 +1,8 @@
# v0.1.17
- Fix new invite button not working
- Fix some descriptions possibly overflowing widths
- Update dependencies
# v0.1.16 # v0.1.16
- Fix empty invite index page - Fix empty invite index page
- Fix faq copy - Fix faq copy

View File

@ -4,8 +4,8 @@ defmodule Memex.Accounts.User do
""" """
use Ecto.Schema use Ecto.Schema
use Gettext, backend: MemexWeb.Gettext
import Ecto.Changeset import Ecto.Changeset
import MemexWeb.Gettext
alias Ecto.{Association, Changeset, UUID} alias Ecto.{Association, Changeset, UUID}
alias Memex.Accounts.{Invite, User} alias Memex.Accounts.{Invite, User}

View File

@ -4,8 +4,8 @@ defmodule Memex.Contexts.Context do
into a single consideration into a single consideration
""" """
use Ecto.Schema use Ecto.Schema
use Gettext, backend: MemexWeb.Gettext
import Ecto.Changeset import Ecto.Changeset
import MemexWeb.Gettext
alias Ecto.{Changeset, UUID} alias Ecto.{Changeset, UUID}
alias Memex.{Accounts.User, Repo} alias Memex.{Accounts.User, Repo}

View File

@ -7,8 +7,8 @@ defmodule Memex.Email do
`lib/memex_web/components/layouts/email_text.txt.eex` for text emails. `lib/memex_web/components/layouts/email_text.txt.eex` for text emails.
""" """
use Gettext, backend: MemexWeb.Gettext
import Swoosh.Email import Swoosh.Email
import MemexWeb.Gettext
import Phoenix.Template import Phoenix.Template
alias Memex.Accounts.User alias Memex.Accounts.User
alias MemexWeb.{EmailHTML, Layouts} alias MemexWeb.{EmailHTML, Layouts}

View File

@ -3,8 +3,8 @@ defmodule Memex.Notes.Note do
Schema for a user-written note Schema for a user-written note
""" """
use Ecto.Schema use Ecto.Schema
use Gettext, backend: MemexWeb.Gettext
import Ecto.Changeset import Ecto.Changeset
import MemexWeb.Gettext
alias Ecto.{Changeset, UUID} alias Ecto.{Changeset, UUID}
alias Memex.{Accounts.User, Repo} alias Memex.{Accounts.User, Repo}

View File

@ -3,8 +3,8 @@ defmodule Memex.Pipelines.Pipeline do
Represents a chain of considerations to take to accomplish a task Represents a chain of considerations to take to accomplish a task
""" """
use Ecto.Schema use Ecto.Schema
use Gettext, backend: MemexWeb.Gettext
import Ecto.Changeset import Ecto.Changeset
import MemexWeb.Gettext
alias Ecto.{Changeset, UUID} alias Ecto.{Changeset, UUID}
alias Memex.{Accounts.User, Pipelines.Steps.Step, Repo} alias Memex.{Accounts.User, Pipelines.Steps.Step, Repo}

View File

@ -42,9 +42,9 @@ defmodule MemexWeb do
formats: [:html, :json], formats: [:html, :json],
layouts: [html: MemexWeb.Layouts] layouts: [html: MemexWeb.Layouts]
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse use Gettext, backend: MemexWeb.Gettext
import Plug.Conn import Plug.Conn
import MemexWeb.Gettext
unquote(verified_routes()) unquote(verified_routes())
end end
@ -84,8 +84,9 @@ defmodule MemexWeb do
defp html_helpers do defp html_helpers do
quote do quote do
use PhoenixHTMLHelpers use PhoenixHTMLHelpers
use Gettext, backend: MemexWeb.Gettext
import Phoenix.{Component, HTML, HTML.Form} import Phoenix.{Component, HTML, HTML.Form}
import MemexWeb.{ErrorHelpers, Gettext, CoreComponents, HTMLHelpers} import MemexWeb.{ErrorHelpers, CoreComponents, HTMLHelpers}
# Shortcut for generating JS commands # Shortcut for generating JS commands
alias Phoenix.LiveView.JS alias Phoenix.LiveView.JS

View File

@ -5,7 +5,8 @@ defmodule MemexWeb.CoreComponents do
use PhoenixHTMLHelpers use PhoenixHTMLHelpers
use Phoenix.Component use Phoenix.Component
use MemexWeb, :verified_routes 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.{Accounts, Accounts.Invite, Accounts.User}
alias Memex.Contexts.Context alias Memex.Contexts.Context
alias Memex.Notes.Note alias Memex.Notes.Note

View File

@ -1,5 +1,5 @@
defmodule MemexWeb.ErrorJSON do defmodule MemexWeb.ErrorJSON do
import MemexWeb.Gettext use Gettext, backend: MemexWeb.Gettext
def render(template, _assigns) do def render(template, _assigns) do
error_string = error_string =

View File

@ -4,9 +4,9 @@ defmodule MemexWeb.UserAuth do
""" """
use MemexWeb, :verified_routes use MemexWeb, :verified_routes
use Gettext, backend: MemexWeb.Gettext
import Plug.Conn import Plug.Conn
import Phoenix.Controller import Phoenix.Controller
import MemexWeb.Gettext
alias Memex.{Accounts, Accounts.User} alias Memex.{Accounts, Accounts.User}
# Make the remember me cookie valid for 60 days. # Make the remember me cookie valid for 60 days.

View File

@ -1,7 +1,6 @@
defmodule MemexWeb.UserConfirmationController do defmodule MemexWeb.UserConfirmationController do
use MemexWeb, :controller use MemexWeb, :controller
use Gettext, backend: MemexWeb.Gettext
import MemexWeb.Gettext
alias Memex.Accounts alias Memex.Accounts
def new(conn, _params) do def new(conn, _params) do

View File

@ -1,6 +1,6 @@
defmodule MemexWeb.UserRegistrationController do defmodule MemexWeb.UserRegistrationController do
use MemexWeb, :controller use MemexWeb, :controller
import MemexWeb.Gettext use Gettext, backend: MemexWeb.Gettext
alias Ecto.Changeset alias Ecto.Changeset
alias Memex.{Accounts, Accounts.Invites} alias Memex.{Accounts, Accounts.Invites}

View File

@ -1,6 +1,6 @@
defmodule MemexWeb.UserSettingsController do defmodule MemexWeb.UserSettingsController do
use MemexWeb, :controller use MemexWeb, :controller
import MemexWeb.Gettext use Gettext, backend: MemexWeb.Gettext
alias Memex.Accounts alias Memex.Accounts
alias MemexWeb.UserAuth alias MemexWeb.UserAuth

View File

@ -5,7 +5,7 @@ defmodule MemexWeb.Gettext do
By using [Gettext](https://hexdocs.pm/gettext), By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example: your module gains a set of macros for translations, for example:
import MemexWeb.Gettext use Gettext, backend: MemexWeb.Gettext
# Simple translation # Simple translation
gettext("Here is the string to translate") 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. See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
""" """
use Gettext, otp_app: :memex use Gettext.Backend, otp_app: :memex
end end

View File

@ -4,7 +4,7 @@ defmodule Memex.MixProject do
def project do def project do
[ [
app: :memex, app: :memex,
version: "0.1.16", version: "0.1.17",
elixir: "1.18.1", elixir: "1.18.1",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod, start_permanent: Mix.env() == :prod,

View File

@ -662,7 +662,7 @@ msgstr ""
msgid "log out" msgid "log out"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:8 #: lib/memex_web/controllers/user_confirmation_controller.ex:7
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "confirm your account" msgid "confirm your account"
msgstr "" msgstr ""

View File

@ -135,7 +135,7 @@ msgstr ""
msgid "sorry, public registration is disabled" msgid "sorry, public registration is disabled"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:53 #: lib/memex_web/controllers/user_confirmation_controller.ex:52
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "user confirmation link is invalid or it has expired." msgid "user confirmation link is invalid or it has expired."
msgstr "" msgstr ""

View File

@ -10,7 +10,7 @@ msgid ""
msgstr "" msgstr ""
"Language: de\n" "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 #, elixir-autogen, elixir-format
msgid "%{email} confirmed successfully." msgid "%{email} confirmed successfully."
msgstr "" msgstr ""
@ -142,7 +142,7 @@ msgstr ""
msgid "saving..." msgid "saving..."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:23 #: lib/memex_web/controllers/user_confirmation_controller.ex:22
#, elixir-autogen, elixir-format, fuzzy #, 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." msgid "if your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
msgstr "" msgstr ""

View File

@ -660,7 +660,7 @@ msgstr ""
msgid "log out" msgid "log out"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:8 #: lib/memex_web/controllers/user_confirmation_controller.ex:7
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "confirm your account" msgid "confirm your account"
msgstr "" msgstr ""

View File

@ -661,7 +661,7 @@ msgstr ""
msgid "log out" msgid "log out"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:8 #: lib/memex_web/controllers/user_confirmation_controller.ex:7
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "confirm your account" msgid "confirm your account"
msgstr "" msgstr ""

View File

@ -136,7 +136,7 @@ msgstr ""
msgid "sorry, public registration is disabled" msgid "sorry, public registration is disabled"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:53 #: lib/memex_web/controllers/user_confirmation_controller.ex:52
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "user confirmation link is invalid or it has expired." msgid "user confirmation link is invalid or it has expired."
msgstr "" msgstr ""

View File

@ -11,7 +11,7 @@ msgstr ""
"Language: en\n" "Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\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 #, elixir-autogen, elixir-format
msgid "%{email} confirmed successfully." msgid "%{email} confirmed successfully."
msgstr "" msgstr ""
@ -143,7 +143,7 @@ msgstr ""
msgid "saving..." msgid "saving..."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:23 #: lib/memex_web/controllers/user_confirmation_controller.ex:22
#, elixir-autogen, elixir-format, fuzzy #, 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." msgid "if your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
msgstr "" msgstr ""

View File

@ -135,7 +135,7 @@ msgstr ""
msgid "sorry, public registration is disabled" msgid "sorry, public registration is disabled"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:53 #: lib/memex_web/controllers/user_confirmation_controller.ex:52
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "user confirmation link is invalid or it has expired." msgid "user confirmation link is invalid or it has expired."
msgstr "" msgstr ""

View File

@ -10,7 +10,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:37 #: lib/memex_web/controllers/user_confirmation_controller.ex:36
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{email} confirmed successfully." msgid "%{email} confirmed successfully."
msgstr "" msgstr ""
@ -142,7 +142,7 @@ msgstr ""
msgid "saving..." msgid "saving..."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_confirmation_controller.ex:23 #: lib/memex_web/controllers/user_confirmation_controller.ex:22
#, elixir-autogen, elixir-format #, 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." msgid "if your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
msgstr "" msgstr ""