2

I have customized my register_content.html.twig like that

            <form class="form-horizontal" action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST">
                <div id="fos_user_registration_form">
                <div class="form-group">
                    <div class="col-sm-10">
                        {{ form_widget(form.username, { 'attr': {'class': 'form-control', 'placeholder': 'Pick a username' } }) }}
                        {{ form_errors(form.username) }}
                    </div>
                </div> ...

And now, when I'm getting an errors, those errors looks like that

fos_user.username.already_used
fos_user.email.already_used
fos_user.password.mismatch

I just want to change those messages, could anyone help me?

1
  • 1
    Did you enable the translator service in your application config? Commented Jun 19, 2016 at 6:29

1 Answer 1

5

Once you enable the translator service, e.g.,

app\config\config.yml:

framework:
    translator:      { fallback: "%locale%" }

copy the appropriate FOSUserBundle.{locale}.yml from ...vendor/friendsofsymfony/userbundle/Resources/translations to ...app/Resources/translations. In the copied file, change the messages for

fos_user.username.already_used
fos_user.email.already_used
fos_user.password.mismatch
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.