我使用FOSUserBundle登录表单,我想翻译错误消息。这些消息将在这里展开:供应商/ symfony中/ src目录/ Symfony的/分量/安全/核心/认证/供应商/ 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.');
}
}
}
我已经写应用程序/资源/翻译/ validators.fr .yml
"The presented password cannot be empty.": "Veuillez saisir un mot de passe."
我已经写应用程序/资源/翻译/ messages.fr.yml
"The presented password cannot be empty.": "Veuillez saisir un mot de passe."
但它不起作用。 其他翻译正在工作(=> fr),但我遇到了这些消息的问题。
这些消息的特殊过程?
是的,这是一个想法,我会尝试。 – bux 2011-12-14 11:42:39
识别是FOSUserBundle的内部:/我不能赶上 – bux 2011-12-14 12:05:40