Allow user to register with custom language

This commit is contained in:
Tusooa Zhu 2022-03-02 01:41:13 -05:00
commit e644f8dea5
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
7 changed files with 93 additions and 3 deletions

View file

@ -12,6 +12,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
alias Pleroma.UserInviteToken
def register_user(params, opts \\ []) do
fallback_language = Gettext.get_locale()
params =
params
|> Map.take([:email, :token, :password])
@ -21,6 +23,10 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|> Map.put(:password_confirmation, params[:password])
|> Map.put(:registration_reason, params[:reason])
|> Map.put(:birthday, params[:birthday])
|> Map.put(
:language,
Pleroma.Web.Gettext.normalize_locale(params[:language]) || fallback_language
)
if Pleroma.Config.get([:instance, :registrations_open]) do
create_user(params, opts)