0re1's avatar
Level 1

Validation messages are not localized properly

I have a file validation.php and I have localized the messages in there for two languages (CZ and DE). AFAIK everythink works fine regarding localization except validation messages. When I try to login to the Laravel app(in CZ), the wrong localization validation string is returned(DE). When I rename or delete the localization file validation.php for DE I am getting the localization string from I got the proper string in CZ. I am using arcanedev localization (https://github.com/ARCANEDEV/Localization) in the latest version and also laravel. What could be possibly wrong or how to debug this kind of thing? Thanks a lot. I am clueless :-/

0 likes
1 reply
0re1's avatar
0re1
OP
Best Answer
Level 1

I have found out that the $locale wasn't set implicitly properly (still don't know why and maybe it is a bug but I have a workaround) in AuthController.php and I have to call the trans function with explicit locale mentioned as shown in a code below:

    protected function getFailedLoginMessage()
    {
        return trans('validation.wrong_credentials',[],'messages', Localization::getCurrentLocale());
    }

Please or to participate in this conversation.