I started to prepare localization strings for my application based on Laravel 8.19, and I found that nested arrays are not working. I copied auth.php from \resources\lang\en to \resources\lang\ru and added few strings in nested array
'login' => 'Войти',
'logout' => 'Выйти',
'password' => [
'definition' => 'пароль',
'forgot' => 'Забыли пароль?',
],
'remember' => 'Запомнить меня',
'failed' => 'Учетные данные не совпадают с нашими записями.',
'password' => 'Пароль неверный.',
'throttle' => 'Слишком много попыток входа. Пожалуйста попробуйте снова через :seconds секунд.',
Then in login page \resources\views\auth\login.blade.php I try to echo lang strings.
<div class="flex items-center justify-end mt-4">
@if (Route::has('password.request'))
<a class="underline text-sm text-gray-600 hover:text-gray-900"
href="{{ route('password.request') }}">
{{ __('auth.password.forgot') }}
</a>
@endif
<x-button class="ml-3">
{{ __('auth.login') }}
</x-button>
</div>
But auth.password.definition
and auth.password.forgot
are not working. I see "auth.password.definition" on the page like I don't have this string defined in the auth.php file. What can be wrong?
I found in my old project on Laravel 5 that I used the trans()
function to retrieve localization strings, and it also worked with nested arrays like above. Now trans()
cannot help with that.