Laravel Translation months Why doesn't the translation of the name of the month work? I have this code but whatever I do it doesn't change the name, it always remains in English. I'm using Laravel 10 and PHP 8.2.12
<td>
@php
setlocale(LC_TIME, 'it');
$date = strtotime($val['date_logs']);
$dat = date('F', $date);
@endphp
{{ $dat }}
</td>
Result : January
@marcoplus Make sure that you set the configured language in the config file properly. Setting timezone globally is preferable.
However, alternatively, this might work.
@php
setlocale(LC_TIME, 'it_IT');
Carbon\Carbon::setLocale('it');
$dat = Carbon\Carbon::parse($val['date_logs'])->translatedFormat('F');
@endphp
{{ $dat }}
@tisuchi Thanks for the reply, yes I followed the steps to do it in config app
'timezone' => 'Europe/Rome',
'local' => 'it',
'fallback_locale' => 'it',
'faker_locale' => 'it_IT',
I also added Laravel Lang
Please sign in or create an account to participate in this conversation.