25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

mod_register language reworked

This commit is contained in:
Allan Nordhøy 2021-01-13 09:35:36 +01:00 committed by GitHub
parent 83cea3c23e
commit 3906b5300c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,11 +115,11 @@ process([<<"new">>],
{success, ok, {Username, Host, _Password}} -> {success, ok, {Username, Host, _Password}} ->
Jid = jid:make(Username, Host), Jid = jid:make(Username, Host),
mod_register:send_registration_notifications(?MODULE, Jid, Ip), mod_register:send_registration_notifications(?MODULE, Jid, Ip),
Text = translate:translate(Lang, ?T("Your XMPP account was successfully created.")), Text = translate:translate(Lang, ?T("XMPP account created.")),
{200, [], Text}; {200, [], Text};
Error -> Error ->
ErrorText = ErrorText =
list_to_binary([translate:translate(Lang, ?T("There was an error creating the account: ")), list_to_binary([translate:translate(Lang, ?T("Could not create the account: ")),
translate:translate(Lang, get_error_text(Error))]), translate:translate(Lang, get_error_text(Error))]),
{404, [], ErrorText} {404, [], ErrorText}
end; end;
@ -128,11 +128,11 @@ process([<<"delete">>],
host = _HTTPHost}) -> host = _HTTPHost}) ->
case form_del_post(Q) of case form_del_post(Q) of
{atomic, ok} -> {atomic, ok} ->
Text = translate:translate(Lang, ?T("Your XMPP account was successfully deleted.")), Text = translate:translate(Lang, ?T("XMPP account deleted.")),
{200, [], Text}; {200, [], Text};
Error -> Error ->
ErrorText = ErrorText =
list_to_binary([translate:translate(Lang, ?T("There was an error deleting the account: ")), list_to_binary([translate:translate(Lang, ?T("Could not delete the account: ")),
translate:translate(Lang, get_error_text(Error))]), translate:translate(Lang, get_error_text(Error))]),
{404, [], ErrorText} {404, [], ErrorText}
end; end;
@ -143,11 +143,11 @@ process([<<"change_password">>],
host = _HTTPHost}) -> host = _HTTPHost}) ->
case form_changepass_post(Q) of case form_changepass_post(Q) of
{atomic, ok} -> {atomic, ok} ->
Text = translate:translate(Lang, ?T("The password of your XMPP account was successfully changed.")), Text = translate:translate(Lang, ?T("XMPP account password changed.")),
{200, [], Text}; {200, [], Text};
Error -> Error ->
ErrorText = ErrorText =
list_to_binary([translate:translate(Lang, ?T("There was an error changing the password: ")), list_to_binary([translate:translate(Lang, ?T("Could not change the password: ")),
translate:translate(Lang, get_error_text(Error))]), translate:translate(Lang, get_error_text(Error))]),
{404, [], ErrorText} {404, [], ErrorText}
end; end;
@ -184,7 +184,7 @@ css() ->
{ok, Data} -> {ok, Data} ->
{ok, Data}; {ok, Data};
{error, Why} -> {error, Why} ->
?ERROR_MSG("Failed to read ~ts: ~ts", [File, file:format_error(Why)]), ?ERROR_MSG("Could not read ~ts: ~ts", [File, file:format_error(Why)]),
error error
end. end.
@ -232,7 +232,7 @@ form_new_get(Host, Lang, IP) ->
form_new_get2(Host, Lang, CaptchaEls) form_new_get2(Host, Lang, CaptchaEls)
catch catch
throw:Result -> throw:Result ->
?DEBUG("Unexpected result when creating a captcha: ~p", [Result]), ?DEBUG("Unexpected result when creating a CAPTCHA: ~p", [Result]),
ejabberd_web:error(not_allowed) ejabberd_web:error(not_allowed)
end. end.
@ -249,11 +249,11 @@ form_new_get2(Host, Lang, CaptchaEls) ->
{<<"style">>, <<"text-align:center;">>}], {<<"style">>, <<"text-align:center;">>}],
?T("Register an XMPP account")), ?T("Register an XMPP account")),
?XCT(<<"p">>, ?XCT(<<"p">>,
?T("This page allows to create an XMPP " ?T("This page allows creating an XMPP "
"account in this XMPP server. Your " "account on this XMPP server. Your "
"JID (Jabber IDentifier) will be of the " "JID (Jabber ID) will be of the "
"form: username@server. Please read carefully " "form: username@server. Please read the "
"the instructions to fill correctly the " "instructions carefully before filling in the "
"fields.")), "fields.")),
?XAE(<<"form">>, ?XAE(<<"form">>,
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}], [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
@ -265,8 +265,8 @@ form_new_get2(Host, Lang, CaptchaEls) ->
?BR, ?BR,
?XE(<<"ul">>, ?XE(<<"ul">>,
[?XCT(<<"li">>, [?XCT(<<"li">>,
?T("This is case insensitive: macbeth is " ?T("This is case insensitive: \"macbeth\" is "
"the same that MacBeth and Macbeth.")), "the same as \"MacBeth\" and \"Macbeth\".")),
?XC(<<"li">>, ?XC(<<"li">>,
<<(translate:translate(Lang, ?T("Characters not allowed:")))/binary, <<(translate:translate(Lang, ?T("Characters not allowed:")))/binary,
" \" & ' / : < > @ ">>)])]), " \" & ' / : < > @ ">>)])]),
@ -284,15 +284,15 @@ form_new_get2(Host, Lang, CaptchaEls) ->
"not even the administrators of the XMPP " "not even the administrators of the XMPP "
"server.")), "server.")),
?XCT(<<"li">>, ?XCT(<<"li">>,
?T("You can later change your password using " ?T("You can change your password using "
"an XMPP client.")), "an XMPP client later.")),
?XCT(<<"li">>, ?XCT(<<"li">>,
?T("Some XMPP clients can store your password " ?T("Some XMPP clients can store your password "
"in the computer, but you should do this only " "on the computer, but for safety reasons "
"in your personal computer for safety reasons.")), "you should do this on your personal computers .")),
?XCT(<<"li">>, ?XCT(<<"li">>,
?T("Memorize your password, or write it " ?T("Memorize your password, or write it "
"in a paper placed in a safe place. In " "on a paper placed in a safe place. In "
"XMPP there isn't an automated way " "XMPP there isn't an automated way "
"to recover your password if you forget " "to recover your password if you forget "
"it."))])]), "it."))])]),
@ -504,8 +504,8 @@ form_del_get(Host, Lang) ->
{<<"style">>, <<"text-align:center;">>}], {<<"style">>, <<"text-align:center;">>}],
?T("Unregister an XMPP account")), ?T("Unregister an XMPP account")),
?XCT(<<"p">>, ?XCT(<<"p">>,
?T("This page allows to unregister an XMPP " ?T("This page allows unregistering an XMPP "
"account in this XMPP server.")), "account on this XMPP server.")),
?XAE(<<"form">>, ?XAE(<<"form">>,
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}], [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
[?XE(<<"ol">>, [?XE(<<"ol">>,
@ -596,7 +596,7 @@ unregister_account(Username, Host, Password) ->
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
get_error_text({error, captcha_non_valid}) -> get_error_text({error, captcha_non_valid}) ->
?T("The captcha you entered is wrong"); ?T("Wrong CAPTCHA entered");
get_error_text({error, exists}) -> get_error_text({error, exists}) ->
?T("The account already exists"); ?T("The account already exists");
get_error_text({error, password_incorrect}) -> get_error_text({error, password_incorrect}) ->
@ -627,11 +627,11 @@ mod_doc() ->
?T("- Delete an existing account on the server."), "", ?T("- Delete an existing account on the server."), "",
?T("This module supports CAPTCHA image to register a new account. " ?T("This module supports CAPTCHA image to register a new account. "
"To enable this feature, configure the options 'captcha\_cmd' " "To enable this feature, configure the options 'captcha\_cmd' "
"and 'captcha\_url', which are documented in the section with " "and 'captcha\_url', documented in the section with "
"top-level options."), "", "top-level options."), "",
?T("As an example usage, the users of the host 'example.org' can " ?T("As a usage example, users of the host 'example.org' can "
"visit the page: 'https://example.org:5281/register/' It is " "visit the page: 'https://example.org:5281/register/' It is "
"important to include the last / character in the URL, " "important to include the last \"/\" character in the URL, "
"otherwise the subpages URL will be incorrect."), "", "otherwise the URLs for subpages will be incorrect."), "",
?T("The module depends on 'mod_register' where all the configuration " ?T("The module depends on 'mod_register' where all the configuration "
"is performed.")]}. "is performed.")]}.