Change your default locale on Debian

Debian 7 - wheezy

To check which locale you currently have as default just run:

$ locale



How to change your default locale on Debian

Check also your locale with command

$ cat /etc/default/locale



or type to see a list of installed locales

$ locale -a


LANG="en_US.UTF-8"
LANGUAGE="en_US:en"


then run

$ dpkg-reconfigure locales


This changes /etc/default/locale and /etc/locale.gen

You can install multiple locales, It is very helpful if you have a multi-language website.
after changes check again your locale

cat /etc/default/locale


Now with PHP you can generate user date in multi-languages

In croatian language

<?php
 setlocale(LC_TIME, 'hr_HR.UTF-8');
 echo strftime('%a %e %B %Y',time());

or in dutch language as

<?php
 setlocale(LC_TIME, 'nl_NL.UTF-8');
 echo strftime('%a %e %B %Y',time());


more about : setlocale — Set locale information
Syntax:

setlocale($category,$locale);

category
category is a named constant specifying the category of the functions affected by the locale setting:

locale
If locale is NULL or the empty string "", the locale names will be set from the values of environment variables with the same names as the above categories, or from "LANG".

If locale is "0", the locale setting is not affected, only the current setting is returned.

If locale is an array or followed by additional parameters then each array element or parameter is tried to be set as new locale until success. This is useful if a locale is known under different names on different systems or for providing a fallback for a possibly not available locale.

 


Links:
Change language on your Debian system
setlocale - php.net