My code:
setlocale(LC_TIME, 'ca_ES');
echo strftime("%#d %B", strtotime($ticket->date_created));
outputs something like:
28 August
instead of my expectation:
28 Agost
I expect "Agost" because that is Catalan language (set through setlocale()
).
Is this how setlocale
and strftime
is supposed to work?
FYI: My local development machine is Windows 7, set to locale: en-PH
You need to install the locale you want in your server.
locale -a
sudo locale-gen ca_ES
sudo update-locale
sudo service apache2 restart
That is it!
The locale names are different on Windows. It looks like it's defaulting to English.
Try the full length name (you can try several and it will pick the first found):
setlocale(LC_TIME, 'ca_ES', 'Catalan_Spain', 'Catalan');
You may look at this table, which may be helpful : http://docs.moodle.org/dev/Table_of_locales
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With