PHP and setlocale – getting more locales than English to work

Update I’ve had to revise this one, the original post might work (or not) if you have an older install of Ubuntu, atm (2013-02) I use Lucid, and now the following process works:

1.) echo sv_SE.UTF-8 UTF-8 >> /var/lib/locales/supported.d/local

2.) dpkg-reconfigure locales

3.) Test with the following:

setlocale(LC_TIME, 'sv_SE.utf8');
echo strftime("%B", strtotime('2011-05-01'));

The following is required to get for instance Swedish to work (worked as per February 21st, 2011):

1.) apt-get install language-pack-sv-base

2.) Restart Apache: /etc/init.d/apache2 restart

3.) Test with the following:

setlocale(LC_TIME, 'sv_SE');
echo strftime("%B", strtotime('2011-05-01'));

The above should output maj.


Related Posts

Tags: , ,