Locale configuration post-Intrepid


I was reminded this morning after a bit of chatter on #debian-cli that my previous write-up on setting one’s locale on Ubuntu is out-of-date. Instead of running dpkg-reconfigure locales and selecting your locale, the new incantation is as follows:

Magic

$ sudo locale-gen en_US.UTF-8

Environment Variables

You’ll also want to set some environment variables. Put something like the following in your ~/.bashrc:

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_ALL=en_US.UTF-8

export LANG LANGUAGE LC_CTYPE LC_MESSAGES LC_ALL

You would of course replace en_US.UTF-8 with whichever locale you want to generate.

, , , ,

8 responses to “Locale configuration post-Intrepid”

  1. Is there a reason you set LC_ALL and LANGUAGE in addition to LANG? I would imagine the only effect would be to break programs that set variables such as LC_COLLATE to fit the programmer’s assumptions predictable behavior.

    Anyway, thanks for writing this. It is interesting to see how operating systems are changing.

    • These are the variables mentioned in perl’s warning message:

      http://wp.colliertech.org/cj/?p=388

      perl: warning: Setting locale failed.
      perl: warning: Please check that your locale settings:
      	LANGUAGE = (unset),
      	LC_ALL = "en_US.UTF-8",
      	LANG = "en_US.UTF-8"
          are supported and installed on your system.
      perl: warning: Falling back to the standard locale ("C").
      locale: Cannot set LC_CTYPE to default locale: No such file or directory
      locale: Cannot set LC_MESSAGES to default locale: No such file or directory
      locale: Cannot set LC_ALL to default locale: No such file or directory
      

      I guess I should add LC_CTYPE and LC_MESSAGES, too, eh? :)

  2. I use the following for having a system which uses English as
    the basic language, but (Northern) European conventions for timestamps
    and paper formats. I understand the strange “en_DK” locale was
    specifically created for this purpose:

    LANG=”en_US.UTF-8″
    LC_TIME=”en_DK.UTF-8″
    LC_PAPER=”en_DK.UTF-8″

    cheers,
    Michael

Leave a Reply