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

ngoquocdat's avatar

Laravel fails to translate key translations

I'm getting a problem that Laravel not translate my translations key, even though it's the default. I also tried optimize:clear

0 likes
5 replies
click's avatar

Your screenshot does not show if the file /lang/en/auth.php exists.

And could you try trans('auth.password', null, 'en') and see what the result is ?

ngoquocdat's avatar

@click The same goes for other keys, not just auth

There is my folder trees

ngoquocdat's avatar

@click It say

Illuminate\Translation\Translator::get(): Argument #2 ($replace) must be of type array, null given, called in C:\Users\datle\Documents\Code\shop\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 851
ngoquocdat's avatar

I try trans('auth.password', [], 'en'); but it still show auth.password

click's avatar

@datlechin Strange, and I assume your /lang/en/auth.php does contain the regular password translation, correct? Did you change any configuration related to language or translations? Or maybe upgraded your Laravel recently?

Do you also have the following directory /resources/lang ?

Could you also try removing the /lang/vi.json and test again?

Please or to participate in this conversation.