I've written a web application for which the user interface is in Dutch. I use the system's date and time routines to format date strings in the application. However, the date strings that the system formats are in English but I want them in Dutch, so I need to set the system's locale. How do I do that on Debian? I tried setting LC_ALL=nl_NL but it doesn't seem to have any effect:

$ date
Sat Aug 15 14:31:31 UTC 2009
$ LC_ALL=nl_NL date
Sat Aug 15 14:31:36 UTC 2009

I remember that setting LC_ALL on my Ubuntu desktop system works fine. Do I need to install extra packages to make this work, or am I doing it entirely wrong?

link|improve this question

33% accept rate
feedback

3 Answers

up vote 13 down vote accepted

Edit /etc/default/locale and set the contents to:

LANG="nl_NL.UTF-8"

You can check which locales you currently have generated using:

# locale -a

You can generate more by editing /var/lib/belocs/list and adding one per line. When you've added your locales, you can generate them by running:

# locale-gen

You can find a list of supported locales in /usr/share/i18n/SUPPORTED

There is more information available on the Debian wiki.

link|improve this answer
2  
/var/lib/belocs/list doesn't exist. You need to edit /etc/locale.gen or run dpkg-reconfigure locales instead. – pgs Aug 16 '09 at 2:44
+1 this answer for describing locale-gen, but as per the previous comment, there's no such file as /var/lib/belocs/list on my system – telent Jul 12 '11 at 19:52
feedback

You may need to install the locales package. This will ask you which locales to generate. If it's already installed, then dkpg-reconfigure locales will let you generate more locales.

link|improve this answer
That only generates locales, not set the system default. – David Pashley Aug 15 '09 at 15:54
4  
NO, the final question of dpkg-reconfigure locales is to select the default locale. – pgs Aug 16 '09 at 2:42
feedback

For a web application, it might be better to use setlocale() inside the program, rather than requiring that the system default locale be set appropriately outside. Less loose ends that way.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.