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:


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


2009-11-13 12:36:54



2010-04-02 03:38:19

Yeah, but what WE want is an easy and comprehensive way to set the following:

Time zone: Spain
Language: Englisn (any.. I don't care)
First Day of week: Monday (like in Spain and many, many other countries)
Possibility to log in in Spanish and English and French - The Man pages, as well as the panel menus should be in the same language.

It seems that this will be accomplished in the XXII century when it should be one of the first things to do.

ubuntudog.com © 2018 | About | Sitemap | Contact