Previously I used the command
dpkg-reconfigure locales
to set locale on Debian/Ubuntu. Now that I got a new Ubuntu 7.10 Gutsy server I was trying to change locale using the familiar command.
But to my surprise it just seemed to run locale-gen, in other words just generating the locale that was default and that is en_US.UTF-8. I never got the chance to select which locale to install. Searching for a solution it seems that nowadays one is supposed to run the command locale-gen followed by the locale to be generated. This has been the case a while for Ubuntu (it's been a while since I ran Ubuntu on the desktop and I've just run Debian on the servers before). Some recommend that you run the Gnome Language tool but I run my servers headless so that is not an option.
Enough talk! Here's a solution. For example to generate a swedish UTF-8 locale run:
locale-gen sv_SE.UTF-8
If you don't know what locales that are supported check out this file:
less /usr/share/i18n/SUPPORTED
I wanted a swedish locale but the language of the system to be in english so I put the following in /etc/environment and /etc/default/locale.
LANG="en_US.UTF-8" LC_ALL="sv_SE.UTF-8" LANGUAGE="en_UTF.UTF-8"
I'm not sure if it's appropriate to put the environment variables, LC_ALL and LANGUAGE, in these files, but it works and that is my main concern. I haven't noticed any side effects yet. Correct me if I'm wrong.
After a logout followed by a login I could verify that the locale was now set correct. The language of the system and commands was in english and the LC:s were set to swedish so that I get formatting according to swedish standards.
Comments
Post new comment