Maybe a bug on checkbox form translate, or what im doing wrong

alnux
Member | 139
+
0
-

Hi, I have a problem with translating a checkbox label, but it's impossible for me, I tried with contribute/translator and now with LiveTranslator, the latter's translation detector finds the Remember me label and translates it but when rendering it continues showing the message in english here screenshot

im using
latte 3.0.7
application 3.1.11
forms 3.1.11
tracy 2.10.3

thanks for the help

dakur
Member | 493
+
0
-

Any code? Can be implemented multiple ways, need to know more…

alnux
Member | 139
+
0
-

dakur wrote:

Any code? Can be implemented multiple ways, need to know more…

hi @dakur thanks, it is like examples on doc with factory:

		$form = $this->formFactory;

		$form->addText('username', 'Email / Username:') //<- this is translated without problem
			->setRequired('Please enter your username.'); // <- this is translated without problem

		$form->addPassword('password', 'Password:') // <- this is translated without problem
			->setRequired('Please enter your password.'); // <- this is translated without problem

		$form->addCheckbox('remember', 'Remember me ?'); // <- just this is the problem cant translate

		$form->addSubmit('send', 'Sign in'); // <- this is translated without problem

if you see it is very simple form, and if you see on screenshot all is translated except checkbox.. is the same problem with contribute/translate

mystik
Member | 312
+
0
-

We need to see code of your FormRenderer or latte template used to display form.

alnux
Member | 139
+
0
-

oky @Mistik here you are, and thanks

<form n:name=$form class="ui form large attached fluid segment">
    <div class="ui equal width padded grid">
        {include main-form-error from '../../../../../../common/Templates/_messages/mainFormError.latte'}
        <div class="row">
            <div class="column">
                <div class="field">
                    {$form['username']->label}
                    {$form['username']->control->required(false)}
                </div>
                <div class="field">
                    {$form['password']->label}
                    {$form['password']->control->required(false)}
                </div>
            </div>
        </div>
        <div class="row middle aligned">
            <div class="column">
                <div class="field">
                    <div class="ui checkbox">
                        <input n:name=remember>
                        <label n:name=remember>{$form['remember']->caption}</label>
                    </div>
                </div>
            </div>
            <div class="column right aligned">
                <div class="field">
                    <input n:name=send class="ui blue submit button"><br/>
                    <a n:href="LoginRegister:recoverpassword" lass="ui primary"><span class="ui small text">{_'Forgot my password'} </span></a>
                </div>
            </div>
        </div>
    </div>
</form>
mystik
Member | 312
+
+2
-

You directly access caption property. Caption property hold raw value you set in control, not translated version.

You should either render label same way as for other elements or you habe to pass caption to translator yourself by using translate filter.