ngaranko/boss_form — pull request #1 by mihawk (2013-12-02 04:00:30+00:00)
Title: Update boss_form.erl

add translation function to the form.
you can use it to translate label and place holder.

ex CB app in a controller:
login('GET', [], ReqCtx) ->
AppName = my_awesome_app,
TranslatorPid = boss_web:translator_pid(AppName),
Locale = "fr",
Lookup = fun(S) ->
case boss_translator:fun_for(TranslatorPid, Locale) of
none -> S;
F -> F(S)
end
end,
Form = boss_form:new(login_form, [], Lookup),
{ok, [{form, Form}]}.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>..

login_form.erl
-module(login_form, [InitialData, Errors, Lookup]).
-compile(export_all).

form_fields() ->
[
{email, [{type, char_field},
{label, Lookup("Email")},
{required, true},
{html_options, [{class, "input-large col-xs-12"},
{placeholder, Lookup("type email")}]}]}
,{password, [{type, char_field},
{widget, password_input},
{label, Lookup("Password")},
{required, true},
{html_options, [{class, "input-large col-xs-12"},
{placeholder, Lookup("type password")}]}]}
].