Installing locales on your Ubuntu server

If your PHP script does not display textual representation of week, day and month in your native language it could depend on locales. First of all test to write the following code in your PHP script:

/* Set locale to Swedish - change sv_SV to your ountry code */
setlocale(LC_ALL, 'sv_SV');

/* Output: fredag 22 december 1978 */
echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));

If the output text is in English than the problem is probably in locales. 

Install locales

1. First of all, list supported locales:

cat /usr/share/i18n/SUPPORTEDĀ 

2. Copy the locales for your region. I will copy the following lines:

sv_SE.UTF-8 UTF-8
sv_SE ISO-8859-1

3. Edit the list of ‘supported locales’ and paste your locales that you’ve copied. (See step above)

nano /var/lib/locales/supported.d/local

4. Finely generate your locales

dpkg-reconfigure locales