Merge branch 'feature/save-user-language' into 'master'

Save user locale and use it to translate things

See merge request framasoft/mobilizon!212
This commit is contained in:
Thomas Citharel 2019-10-01 13:23:30 +02:00
commit 812f80f694
31 changed files with 155 additions and 157 deletions

View File

@ -23,6 +23,7 @@ defmodule Mobilizon.Users.User do
confirmation_token: String.t(), confirmation_token: String.t(),
reset_password_sent_at: DateTime.t(), reset_password_sent_at: DateTime.t(),
reset_password_token: String.t(), reset_password_token: String.t(),
locale: String.t(),
default_actor: Actor.t(), default_actor: Actor.t(),
actors: [Actor.t()], actors: [Actor.t()],
feed_tokens: [FeedToken.t()] feed_tokens: [FeedToken.t()]
@ -37,7 +38,8 @@ defmodule Mobilizon.Users.User do
:confirmation_sent_at, :confirmation_sent_at,
:confirmation_token, :confirmation_token,
:reset_password_sent_at, :reset_password_sent_at,
:reset_password_token :reset_password_token,
:locale
] ]
@attrs @required_attrs ++ @optional_attrs @attrs @required_attrs ++ @optional_attrs
@ -59,6 +61,7 @@ defmodule Mobilizon.Users.User do
field(:confirmation_token, :string) field(:confirmation_token, :string)
field(:reset_password_sent_at, :utc_datetime) field(:reset_password_sent_at, :utc_datetime)
field(:reset_password_token, :string) field(:reset_password_token, :string)
field(:locale, :string, default: "en")
belongs_to(:default_actor, Actor) belongs_to(:default_actor, Actor)
has_many(:actors, Actor) has_many(:actors, Actor)

View File

@ -24,7 +24,7 @@ defmodule Mobilizon.Users do
Registers an user. Registers an user.
""" """
@spec register(map) :: {:ok, User.t()} | {:error, Ecto.Changeset.t()} @spec register(map) :: {:ok, User.t()} | {:error, Ecto.Changeset.t()}
def register(%{email: _email, password: _password} = args) do def register(args) do
with {:ok, %User{} = user} <- with {:ok, %User{} = user} <-
%User{} %User{}
|> User.registration_changeset(args) |> User.registration_changeset(args)

View File

@ -17,7 +17,7 @@ defmodule MobilizonWeb.Email.Admin do
@spec report(User.t(), Report.t(), String.t()) :: Bamboo.Email.t() @spec report(User.t(), Report.t(), String.t()) :: Bamboo.Email.t()
def report(%User{email: email}, %Report{} = report, locale \\ "en") do def report(%User{email: email}, %Report{} = report, locale \\ "en") do
Gettext.put_locale(locale) MobilizonWeb.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(

View File

@ -24,7 +24,7 @@ defmodule MobilizonWeb.Email.Event do
changes, changes,
locale \\ "en" locale \\ "en"
) do ) do
Gettext.put_locale(locale) MobilizonWeb.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(

View File

@ -46,7 +46,7 @@ defmodule MobilizonWeb.Email.Participation do
%Participant{event: event, role: :rejected}, %Participant{event: event, role: :rejected},
locale locale
) do ) do
Gettext.put_locale(locale) MobilizonWeb.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(
@ -67,7 +67,7 @@ defmodule MobilizonWeb.Email.Participation do
%Participant{event: event, role: :participant}, %Participant{event: event, role: :participant},
locale locale
) do ) do
Gettext.put_locale(locale) MobilizonWeb.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(

View File

@ -19,7 +19,7 @@ defmodule MobilizonWeb.Email.User do
%User{email: email, confirmation_token: confirmation_token}, %User{email: email, confirmation_token: confirmation_token},
locale \\ "en" locale \\ "en"
) do ) do
Gettext.put_locale(locale) MobilizonWeb.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(
@ -39,7 +39,7 @@ defmodule MobilizonWeb.Email.User do
%User{email: email, reset_password_token: reset_password_token}, %User{email: email, reset_password_token: reset_password_token},
locale \\ "en" locale \\ "en"
) do ) do
Gettext.put_locale(locale) MobilizonWeb.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(

View File

@ -21,4 +21,27 @@ defmodule MobilizonWeb.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: :mobilizon use Gettext, otp_app: :mobilizon
def put_locale(locale) do
locale = determine_best_locale(locale)
Gettext.put_locale(MobilizonWeb.Gettext, locale)
end
@spec determine_best_locale(String.t()) :: String.t()
def determine_best_locale(locale) do
locale = String.trim(locale)
locales = Gettext.known_locales(MobilizonWeb.Gettext)
cond do
# Either it matches directly, eg: "en" => "en", "fr" => "fr", "fr_FR" => "fr_FR"
locale in locales -> locale
# Either the first part matches, "fr_CA" => "fr"
split_locale(locale) in locales -> split_locale(locale)
# Otherwise default to english
true -> "en"
end
end
# Keep only the first part of the locale
defp split_locale(locale), do: locale |> String.split("_", trim: true, parts: 2) |> hd
end end

View File

@ -116,7 +116,7 @@ defmodule MobilizonWeb.Resolvers.User do
with {:registrations_open, true} <- with {:registrations_open, true} <-
{:registrations_open, Config.instance_registrations_open?()}, {:registrations_open, Config.instance_registrations_open?()},
{:ok, %User{} = user} <- Users.register(args) do {:ok, %User{} = user} <- Users.register(args) do
Activation.send_confirmation_email(user) Activation.send_confirmation_email(user, Map.get(args, :locale, "en"))
{:ok, user} {:ok, user}
else else
{:registrations_open, false} -> {:registrations_open, false} ->
@ -154,10 +154,11 @@ defmodule MobilizonWeb.Resolvers.User do
Send the confirmation email again. Send the confirmation email again.
We only do this to accounts unconfirmed We only do this to accounts unconfirmed
""" """
def resend_confirmation_email(_parent, %{email: email, locale: locale}, _resolution) do def resend_confirmation_email(_parent, args, _resolution) do
with {:ok, user} <- Users.get_user_by_email(email, false), with {:ok, %User{locale: locale} = user} <-
Users.get_user_by_email(Map.get(args, :email), false),
{:ok, email} <- {:ok, email} <-
Activation.resend_confirmation_email(user, locale) do Activation.resend_confirmation_email(user, Map.get(args, :locale, locale)) do
{:ok, email} {:ok, email}
else else
{:error, :user_not_found} -> {:error, :user_not_found} ->
@ -171,10 +172,11 @@ defmodule MobilizonWeb.Resolvers.User do
@doc """ @doc """
Send an email to reset the password from an user Send an email to reset the password from an user
""" """
def send_reset_password(_parent, %{email: email, locale: locale}, _resolution) do def send_reset_password(_parent, args, _resolution) do
with {:ok, user} <- Users.get_user_by_email(email, true), with email <- Map.get(args, :email),
{:ok, %User{locale: locale} = user} <- Users.get_user_by_email(email, true),
{:ok, %Bamboo.Email{} = _email_html} <- {:ok, %Bamboo.Email{} = _email_html} <-
ResetPassword.send_password_reset_email(user, locale) do ResetPassword.send_password_reset_email(user, Map.get(args, :locale, locale)) do
{:ok, email} {:ok, email}
else else
{:error, :user_not_found} -> {:error, :user_not_found} ->

View File

@ -46,6 +46,8 @@ defmodule MobilizonWeb.Schema.UserType do
field(:role, :user_role, description: "The role for the user") field(:role, :user_role, description: "The role for the user")
field(:locale, :string, description: "The user's locale")
field(:participations, list_of(:participant), field(:participations, list_of(:participant),
description: "The list of events this user goes to" description: "The list of events this user goes to"
) do ) do
@ -109,6 +111,7 @@ defmodule MobilizonWeb.Schema.UserType do
field :create_user, type: :user do field :create_user, type: :user do
arg(:email, non_null(:string)) arg(:email, non_null(:string))
arg(:password, non_null(:string)) arg(:password, non_null(:string))
arg(:locale, :string)
resolve(handle_errors(&User.create_user/3)) resolve(handle_errors(&User.create_user/3))
end end
@ -122,14 +125,14 @@ defmodule MobilizonWeb.Schema.UserType do
@desc "Resend registration confirmation token" @desc "Resend registration confirmation token"
field :resend_confirmation_email, type: :string do field :resend_confirmation_email, type: :string do
arg(:email, non_null(:string)) arg(:email, non_null(:string))
arg(:locale, :string, default_value: "en") arg(:locale, :string)
resolve(&User.resend_confirmation_email/3) resolve(&User.resend_confirmation_email/3)
end end
@desc "Send a link through email to reset user password" @desc "Send a link through email to reset user password"
field :send_reset_password, type: :string do field :send_reset_password, type: :string do
arg(:email, non_null(:string)) arg(:email, non_null(:string))
arg(:locale, :string, default_value: "en") arg(:locale, :string)
resolve(&User.send_reset_password/3) resolve(&User.send_reset_password/3)
end end

View File

@ -58,7 +58,7 @@
<%= gettext "Start of event" %> <%= gettext "Start of event" %>
</td> </td>
<td bgcolor="#ffffff" align="left"> <td bgcolor="#ffffff" align="left">
<%= datetime_to_string(@event.begins_on) %> <%= datetime_to_string(@event.begins_on, @locale) %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
@ -68,7 +68,7 @@
<%= gettext "Ending of event" %> <%= gettext "Ending of event" %>
</td> </td>
<td bgcolor="#ffffff" align="left"> <td bgcolor="#ffffff" align="left">
<%= datetime_to_string(@event.ends_on) %> <%= datetime_to_string(@event.ends_on, @locale) %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@ -9,11 +9,11 @@
<% end %> <% end %>
<%= if MapSet.member?(@changes, :begins_on) do %> <%= if MapSet.member?(@changes, :begins_on) do %>
<%= gettext "New date and time for start of event: %{begins_on}", begins_on: datetime_to_string(@event.begins_on) %> <%= gettext "New date and time for start of event: %{begins_on}", begins_on: datetime_to_string(@event.begins_on, @locale) %>
<% end %> <% end %>
<%= if MapSet.member?(@changes, :ends_on) do %> <%= if MapSet.member?(@changes, :ends_on) do %>
<%= gettext "New date and time for ending of event: %{ends_on}", ends_on: datetime_to_string(@event.ends_on) %> <%= gettext "New date and time for ending of event: %{ends_on}", ends_on: datetime_to_string(@event.ends_on, @locale) %>
<% end %> <% end %>
<%= gettext "View the updated event on: %{link}", link: page_url(MobilizonWeb.Endpoint, :event, @event.id) %> <%= gettext "View the updated event on: %{link}", link: page_url(MobilizonWeb.Endpoint, :event, @event.id) %>

View File

@ -35,7 +35,7 @@
<tr> <tr>
<td bgcolor="#ffffff" align="left" style="padding: 20px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;" > <td bgcolor="#ffffff" align="left" style="padding: 20px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;" >
<p style="margin: 0;"> <p style="margin: 0;">
<%= gettext "You requested a new password for your account on %{server}.", server: @instance[:name] %> <%= gettext "You requested a new password for your account on %{instance}.", instance: @instance[:name] %>
</p> </p>
<p style="margin: 0"> <p style="margin: 0">
<%= gettext "Resetting your password is easy. Just press the button below and follow the instructions. We'll have you up and running in no time." %> <%= gettext "Resetting your password is easy. Just press the button below and follow the instructions. We'll have you up and running in no time." %>

View File

@ -2,7 +2,7 @@
== ==
<%= gettext "You requested a new password for your account on %{host}.", host: @instance[:name] %> <%= gettext "You requested a new password for your account on %{instance}.", instance: @instance[:name] %>
<%= gettext "Resetting your password is easy. Just click the link below and follow the instructions. We'll have you up and running in no time." %> <%= gettext "Resetting your password is easy. Just click the link below and follow the instructions. We'll have you up and running in no time." %>

View File

@ -1,6 +1,8 @@
defmodule MobilizonWeb.EmailView do defmodule MobilizonWeb.EmailView do
use MobilizonWeb, :view use MobilizonWeb, :view
import MobilizonWeb.Gettext
def datetime_to_string(%DateTime{} = datetime, locale \\ "en") do def datetime_to_string(%DateTime{} = datetime, locale \\ "en") do
with {:ok, string} <- with {:ok, string} <-
Cldr.DateTime.to_string(datetime, Mobilizon.Cldr, format: :medium, locale: locale) do Cldr.DateTime.to_string(datetime, Mobilizon.Cldr, format: :medium, locale: locale) do

View File

@ -38,13 +38,13 @@ defmodule Mobilizon.Service.Events.Tool do
end end
defp send_notification_for_event_update_to_participant( defp send_notification_for_event_update_to_participant(
{%Actor{} = actor, %User{} = user}, {%Actor{} = actor, %User{locale: locale} = user},
%Event{} = old_event, %Event{} = old_event,
%Event{} = event, %Event{} = event,
diff diff
) do ) do
user user
|> Email.Event.event_updated(actor, old_event, event, diff) |> Email.Event.event_updated(actor, old_event, event, diff, locale)
|> Email.Mailer.deliver_later() |> Email.Mailer.deliver_later()
end end
end end

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -108,11 +108,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -203,11 +198,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -285,3 +275,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -134,11 +134,6 @@ msgstr ""
"You created an account on %{host} with this email address. You are one click " "You created an account on %{host} with this email address. You are one click "
"away from activating it." "away from activating it."
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr "You requested a new password for your account on %{server}."
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -239,11 +234,6 @@ msgstr ""
"You created an account on %{host} with this email address. You are one click " "You created an account on %{host} with this email address. You are one click "
"away from activating it." "away from activating it."
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr "You requested a new password for your account on %{server}."
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -321,3 +311,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "Your participation to event %{title} has been rejected" msgstr "Your participation to event %{title} has been rejected"
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr "You requested a new password for your account on %{instance}."

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -13,7 +13,7 @@ msgstr ""
"PO-Revision-Date: 2019-09-30 17:10+0000\n" "PO-Revision-Date: 2019-09-30 17:10+0000\n"
"Last-Translator: Thomas Citharel <thomas.citharel@framasoft.org>\n" "Last-Translator: Thomas Citharel <thomas.citharel@framasoft.org>\n"
"Language-Team: French <https://weblate.framasoft.org/projects/mobilizon/backend/fr/>\n" "Language-Team: French <https://weblate.framasoft.org/projects/mobilizon/backend/fr/>\n"
"Language: fr_FR\n" "Language: fr\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
@ -130,11 +130,6 @@ msgstr "Voir le signalement"
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "Vous avez créé un compte sur %{host} avec cette adresse email. Vous êtes à un clic de l'activer." msgstr "Vous avez créé un compte sur %{host} avec cette adresse email. Vous êtes à un clic de l'activer."
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr "Vous avez demandé un nouveau mot de passe pour votre compte sur %{server}."
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -234,11 +229,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "Vous avez créé un compte sur %{host} avec cette adresse email. Vous êtes à un clic de l'activer." msgstr "Vous avez créé un compte sur %{host} avec cette adresse email. Vous êtes à un clic de l'activer."
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr "Vous avez demandé un nouveau mot de passe pour votre compte sur %{server}."
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -316,3 +306,9 @@ msgstr "Titre"
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "Voir l'événement mis à jour sur : %{link}" msgstr "Voir l'événement mis à jour sur : %{link}"
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr "Vous avez demandé un nouveau mot de passe pour votre compte sur %{instance}."

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -132,11 +132,6 @@ msgstr ""
"Avètz creat un compte sus %{host} amb aquesta adreça electronica. Sètz a un " "Avètz creat un compte sus %{host} amb aquesta adreça electronica. Sètz a un "
"clic de lactivar." "clic de lactivar."
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr "Avètz demandat un nòu senhal per vòstre compte sus %{server}."
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -231,11 +226,6 @@ msgstr ""
"Avètz creat un compte sus %{host} amb aquesta adreça electronica. Sètz a un " "Avètz creat un compte sus %{host} amb aquesta adreça electronica. Sètz a un "
"clic de lactivar." "clic de lactivar."
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr "Avètz demandat un nòu senhal per vòstre compte sus %{server}."
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -313,3 +303,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr "Avètz demandat un nòu senhal per vòstre compte sus %{instance}."

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -122,11 +122,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it." msgid "You created an account on %{host} with this email address. You are one click away from activating it."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
msgid "You requested a new password for your account on %{server}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/email/user.ex:25 #: lib/mobilizon_web/email/user.ex:25
msgid "Instructions to confirm your Mobilizon account on %{instance}" msgid "Instructions to confirm your Mobilizon account on %{instance}"
@ -217,11 +212,6 @@ msgstr ""
msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email." msgid "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email."
msgstr "" msgstr ""
#, elixir-format
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{host}."
msgstr ""
#, elixir-format #, elixir-format
#: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38 #: lib/mobilizon_web/templates/email/event_participation_approved.html.eex:38
msgid "You requested to participate in event %{title}" msgid "You requested to participate in event %{title}"
@ -299,3 +289,9 @@ msgstr ""
#: lib/mobilizon_web/templates/email/event_updated.text.eex:19 #: lib/mobilizon_web/templates/email/event_updated.text.eex:19
msgid "View the updated event on: %{link}" msgid "View the updated event on: %{link}"
msgstr "" msgstr ""
#, elixir-format, fuzzy
#: lib/mobilizon_web/templates/email/password_reset.html.eex:38
#: lib/mobilizon_web/templates/email/password_reset.text.eex:5
msgid "You requested a new password for your account on %{instance}."
msgstr ""

View File

@ -0,0 +1,9 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddLocaleToUsers do
use Ecto.Migration
def change do
alter table(:users) do
add(:locale, :string, default: "en")
end
end
end

View File

@ -220,6 +220,7 @@ defmodule MobilizonWeb.Resolvers.UserResolverTest do
@user_creation %{ @user_creation %{
email: "test@demo.tld", email: "test@demo.tld",
password: "long password", password: "long password",
locale: "fr_FR",
username: "toto", username: "toto",
name: "Sir Toto", name: "Sir Toto",
summary: "Sir Toto, prince of the functional tests" summary: "Sir Toto, prince of the functional tests"
@ -236,9 +237,11 @@ defmodule MobilizonWeb.Resolvers.UserResolverTest do
createUser( createUser(
email: "#{@user_creation.email}", email: "#{@user_creation.email}",
password: "#{@user_creation.password}", password: "#{@user_creation.password}",
locale: "#{@user_creation.locale}"
) { ) {
id, id,
email email,
locale
} }
} }
""" """
@ -248,6 +251,11 @@ defmodule MobilizonWeb.Resolvers.UserResolverTest do
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation)) |> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
assert json_response(res, 200)["data"]["createUser"]["email"] == @user_creation.email assert json_response(res, 200)["data"]["createUser"]["email"] == @user_creation.email
assert json_response(res, 200)["data"]["createUser"]["locale"] == @user_creation.locale
{:ok, user} = Users.get_user_by_email(@user_creation.email)
assert_delivered_email(Email.User.confirmation_email(user, @user_creation.locale))
mutation = """ mutation = """
mutation { mutation {