Using Laravel 5.3,
In my method I use
setlocale(LC_TIME, 'hr-HR');
dd(Carbon::now()->formatLocalized('%A'));
but I get Sunday
instead of CroatianWordForSunday
.
I tried using Carbon::setLocale('hr')
instead setlocale()
but I still get Sunday
.
In my config/app.php
file I have set 'locale' => 'hr'
.
Thing to note is that Carbon's diffForHumans()
method is successfully translated if I use Carbon::setLocale('hr')
.
In the end all I'm trying to do is convert number 8 to August but in Croatian. I could always just manually change January to Siječanj and so on but it would be nice if it could be done using some PHP's or Carbon's method to keep my code concise.