Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dpir's avatar
Level 2

Problem with validation language

I would like to get validation errors in different languages. Only to test i set the language direct before the validation:

    App::setLocale('de');
        print_r(App::getLocale());

        $this->validate($this->request, [
            'email' => 'required'
        ]);

Instead of the text from 'resources/lang/de/validation.php' i get the 'fallback_locale' language.

After change the 'fallback_locale' to 'de' the german language file is used.

For other text i use Xinax\LaravelGettext.

Could this be the problem?

0 likes
1 reply
dpir's avatar
dpir
OP
Best Answer
Level 2

It was my fault - now with 'use Illuminate\Support\Facades\App' it is ok

Please or to participate in this conversation.