logo

Installing locales on your Ubuntu server

Date: 2009-10-02

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:

Code:


/* 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:

Code:


cat /usr/share/i18n/SUPPORTED


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

Code:


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)

Code:


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


4. Finely generate your locales

Code:


dpkg-reconfigure locales




ubuntudog.com © 2017 | About | Sitemap | Contact