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
- Fix empty invite index page
- Fix faq copy

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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

View File

@ -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

View File

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

View File

@ -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.

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""