mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 15:05:45 +00:00
Use Gettext for error messages
This commit is contained in:
parent
d7a5291b4f
commit
9af9f02f4b
|
@ -7,6 +7,7 @@ defmodule Pleroma.Backup do
|
||||||
|
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
import Pleroma.Web.Gettext
|
||||||
|
|
||||||
require Pleroma.Constants
|
require Pleroma.Constants
|
||||||
|
|
||||||
|
@ -70,7 +71,14 @@ defmodule Pleroma.Backup do
|
||||||
if diff > days do
|
if diff > days do
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
{:error, "Last export was less than #{days} days ago"}
|
{:error,
|
||||||
|
dngettext(
|
||||||
|
"errors",
|
||||||
|
"Last export was less than a day ago",
|
||||||
|
"Last export was less than %{days} days ago",
|
||||||
|
days,
|
||||||
|
days: days
|
||||||
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
nil ->
|
nil ->
|
||||||
|
@ -82,11 +90,14 @@ defmodule Pleroma.Backup do
|
||||||
if Pleroma.Config.get([Pleroma.Emails.Mailer, :enabled]) do
|
if Pleroma.Config.get([Pleroma.Emails.Mailer, :enabled]) do
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
{:error, "Backups require enabled email"}
|
{:error, dgettext("errors", "Backups require enabled email")}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp validate_user_email(%User{email: nil}), do: {:error, "Email is required"}
|
defp validate_user_email(%User{email: nil}) do
|
||||||
|
{:error, dgettext("errors", "Email is required")}
|
||||||
|
end
|
||||||
|
|
||||||
defp validate_user_email(%User{email: email}) when is_binary(email), do: :ok
|
defp validate_user_email(%User{email: email}) when is_binary(email), do: :ok
|
||||||
|
|
||||||
def get_last(user_id) do
|
def get_last(user_id) do
|
||||||
|
|
Loading…
Reference in a new issue