25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Add label in captcha form. Improve translatable strings in captcha and muc room.

SVN Revision: 2100
This commit is contained in:
Badlop 2009-05-26 11:03:45 +00:00
parent 31aa201ee8
commit 5c00365550
2 changed files with 5 additions and 9 deletions

View File

@ -27,11 +27,6 @@
{xmlelement, "field", [{"type", Type}, {"var", Var}],
[{xmlelement, "value", [], [Value]}]}).
-define(CAPTCHA_BODY(Lang, Room, URL),
translate:translate(Lang, "Your messages to ") ++ Room
++ translate:translate(Lang, " are being blocked. To unblock them, visit ")
++ URL).
-define(CAPTCHA_TEXT(Lang), translate:translate(Lang, "Enter the text you see")).
-define(CAPTCHA_LIFETIME, 120000). % two minutes
@ -76,12 +71,14 @@ create_captcha(Id, SID, From, To, Lang, Args)
?VFIELD("hidden", "from", {xmlcdata, jlib:jid_to_string(To)}),
?VFIELD("hidden", "challenge", {xmlcdata, Id}),
?VFIELD("hidden", "sid", {xmlcdata, SID}),
{xmlelement, "field", [{"var", "ocr"}],
{xmlelement, "field", [{"var", "ocr"}, {"label", ?CAPTCHA_TEXT(Lang)}],
[{xmlelement, "media", [{"xmlns", ?NS_MEDIA}],
[{xmlelement, "uri", [{"type", Type}],
[{xmlcdata, "cid:" ++ CID}]}]}]}]}]},
BodyString1 = translate:translate(Lang, "Your messages to ~s are being blocked. To unblock them, visit ~s"),
BodyString = io_lib:format(BodyString1, [JID, get_url(Id)]),
Body = {xmlelement, "body", [],
[{xmlcdata, ?CAPTCHA_BODY(Lang, JID, get_url(Id))}]},
[{xmlcdata, BodyString}]},
OOB = {xmlelement, "x", [{"xmlns", ?NS_OOB}],
[{xmlelement, "url", [], [{xmlcdata, get_url(Id)}]}]},
Tref = erlang:send_after(?CAPTCHA_LIFETIME, ?MODULE, {remove_id, Id}),

View File

@ -2768,8 +2768,7 @@ get_config(Lang, StateData, From) ->
end,
Res =
[{xmlelement, "title", [],
[{xmlcdata, translate:translate(Lang, "Configuration for ") ++
jlib:jid_to_string(StateData#state.jid)}]},
[{xmlcdata, io_lib:format(translate:translate(Lang, "Configuration of room ~s"), [jlib:jid_to_string(StateData#state.jid)])}]},
{xmlelement, "field", [{"type", "hidden"},
{"var", "FORM_TYPE"}],
[{xmlelement, "value", [],