Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6950151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:03:27+00:00 2026-05-27T14:03:27+00:00

I use FOSUserBundle login form and i would like translate errors messages. These messages

  • 0

I use FOSUserBundle login form and i would like translate errors messages. These messages are launched here: vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/DaoAuthenticationProvider.php

protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token)
    {
        $currentUser = $token->getUser();
        if ($currentUser instanceof UserInterface) {
            if ($currentUser->getPassword() !== $user->getPassword()) {
                throw new BadCredentialsException('The credentials were changed from another session.');
            }
        } else {
            if (!$presentedPassword = $token->getCredentials()) {
                throw new BadCredentialsException('The presented password cannot be empty.');
            }

            if (!$this->encoderFactory->getEncoder($user)->isPasswordValid($user->getPassword(), $presentedPassword, $user->getSalt())) {
                throw new BadCredentialsException('The presented password is invalid.');
            }
        }
    }

I’ve write app/Resources/translations/validators.fr.yml

"The presented password cannot be empty.":      "Veuillez saisir un mot de passe."

I’ve write app/Resources/translations/messages.fr.yml

"The presented password cannot be empty.":      "Veuillez saisir un mot de passe."

But it doesn’t work.
Other translation are working (=>fr), but i’ve problem with these messages.

Special procedure for these messages ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:03:28+00:00Added an answer on May 27, 2026 at 2:03 pm

    In file Sonata/UserBundle/Resources/views/Admin/Security/login.html.twig You have:

    <div class="alert-message error">{{ error|trans({}, 'SonataUserBundle') }}</div>
    

    so You must change SonataUserBundle to whatever translation file You are using or add
    src/Your/Bundle/Resources/translations/SonataUserBundle.{locale}.yml

    and inside translation file:

    'Bad credentials': 'Your translation'
    'The presented password is invalid.': 'Your translation'
    'The presented password cannot be empty.': 'Your translation'
    

    I hope it’s clear enough ;]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Symfony 2 and the FOSUserBundle. I can login, logout and view Profile.
I would like to ask about some advices, how to use Symfony2 SonataAdminBundle. I
I'm trying to override FOSUserBundle form Edit profile ; I have created the class
Use of java.net.URLConnection is asked about pretty often here, and the Oracle tutorial is
Which is the best method to implement role based redirect after login in FOSUserBundle
I use the FOSUserBundle and in my User class I want two things: a
use case example I have a servlet that is receiving login requests. If a
Use Html element SELECT in aspx page like: <SELECT id=MySelection name=MySelection runat=server DataValueField=ID DataTextField=Name></SELECT>
Hy guys, I decided to use FOSUserBundle for handling user authentication in my application.
Use trap to capture signals like this: i=-1;while((++i<33)); do trap echo $i >> log.txt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.