0

I'm using PHP's setlocale(LC_TIME, country) to set a server's locale temporarily to Spanish (es_ES.utf8) or french (fr_FR.utf8).

I then use strftime() to print out a date in the selected locale's language.

After testing setlocale by refreshing the page and echoing it out, it is not being set half of the time, and is displaying the date in english as a fall-back.

Are there any reasons that setlocale would not work 100% of the time. It needs to work without fail.

Mark Purnell
  • 181
  • 2
  • 10
  • Is this on Windows, Linux, ...? Are you running mod_php or have a one-process per interpreter context like in fcgi? – Artefacto Apr 19 '13 at 10:20
  • If working with Linux and Apache or Nginx, make sure to [restart the webserver](http://stackoverflow.com/questions/24654379/php-date-and-setlocale-do-not-always-work) after having the locale generated. – halfpastfour.am Jul 10 '14 at 08:35

1 Answers1

0

Chrome caching issues.

Always develop with chrome's cache off from within the developer tool-bar.

Mark Purnell
  • 181
  • 2
  • 10