Hi
Do you have the nl_NL locale installed? Try locale -a in the console and see the installed locales.
See if this helps: http://askubuntu.com/questions/76013/how-do-i-add-locale-to-ubuntu-server
Cheers
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I've read several posts for getting the localization of dates correctly, but none seems to be working for me. So I'm asking again, how will I be able to display dates in my native language (Dutch in this case)? I'm running homestead.
What have I already tried:
/etc/default/locale, as seen from this post https://laracasts.com/discuss/channels/general-discussion/carbon-localized-dateapp.php to nl.setlocale(LC_TIME, 'nl_NL.utf8');.My whole code:
setlocale(LC_TIME, 'nl_NL.utf8');
var_dump(Carbon::now()->format('l jS \\of F Y h:i:s A'));
var_dump(Carbon::now()->formatLocalized('l jS \\of F Y h:i:s A'));
This outputs:
string 'Thursday 23rd of April 2015 10:14:30 AM' (length=39)
string 'l jS \of F Y h:i:s A' (length=20)
I also tried this on top of my routes.php file.
Route::filter('SetLocaleFilter', function()
{
$locale = "nl";
setlocale(LC_ALL, strtolower($locale) . "_" . strtoupper($locale) . ".utf8");
});
I just don't understand it!
Hi
It's working ok for me on homestead.
Installed the nl_NL locale and checked the available locales
setlocale(LC_TIME, 'nl_NL.utf8');
var_dump(\Carbon\Carbon::now()->addMonth()->formatLocalized('%d %B %Y'));
Result
string '23 mei 2015' (length=11)
Cheers
Please or to participate in this conversation.