Smokes your problems, coughs fresh air.

Tag: locale

Fixing locale message in Ubuntu when logging in or SCPing

I’ve encountered this error occasionally when loggin in:

-bash: warning: setlocale: LC_ALL: cannot change locale (nl_NL.UTF-8)

This breaks things like scp or bzr via sftp. To fix it, I followed this advice:

cd /var/lib/locales/supported.d
cat /usr/share/i18n/SUPPORTED|grep -i nl > nl
dpkg-reconfigure locales

It’s not really pretty though; it shouldn’t give an error at all when a locale is missing. I mean, this way, I have to generate every possible locale to support logins from all over the world…

Adding locales in Ubuntu

I wanted the dates on my Kubuntu system to be shown as Dutch dates. Therefore, I needed to add a locale. The place to do it is in /var/lib/locales/supported.d/local. It now contains this:

en_US.UTF-8 UTF-8
nl_NL.UTF-8 UTF-8

Then run locale-gen to generate the locales.

Set the following environment vars (in profile or something) to let everything behave properly:

export LANG="nl_NL.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_COLLATE="C"

I don’t know anymore why I chose this specific configuration. I guess this means that everything, from thousand and decimal separators to dates is Dutch, and messages are English. I don’t know, however, why the collate is C. I vaguely remember something about it otherwise not including some characters in the sorting, causing weird sorting in words with dashes and such.

© 2024 BigSmoke

Theme by Anders NorenUp ↑