system locales configuration

Asked by Tong Sun

Hi,

I am having a hard time trying to configure my system locales. In Debian, I just need to update /etc/locale.gen and do locale-gen, and I'm done. However I found such tactics no longer works under Ubuntu.

So I did some search, and followed the
Locale - Community Ubuntu Documentation
https://help.ubuntu.com/community/Locale

However, that didn't get me anywhere either:

This is my desired locales setting:

$ grep -v '^#' /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
zh_CN GB2312
zh_CN.GB18030 GB18030
zh_CN.UTF-8 UTF-8
zh_HK.UTF-8 UTF-8
zh_TW Big5

This is what I get:

$ sudo dpkg-reconfigure -p low locales
Generating locales...
  en_AG.UTF-8... up-to-date
  en_AU.UTF-8... up-to-date
  en_BW.UTF-8... up-to-date
  en_CA.UTF-8... up-to-date
  en_DK.UTF-8... done
  en_GB.UTF-8... done
  en_HK.UTF-8... done
  en_IE.UTF-8... done
  en_IN.UTF-8... done
  en_NG.UTF-8... done
  en_NZ.UTF-8... done
  en_PH.UTF-8... done
  en_SG.UTF-8... done
  en_US.UTF-8... up-to-date
  en_ZA.UTF-8... up-to-date
  en_ZW.UTF-8... done
Generation complete.

$ sudo apt-get install localeconf
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package localeconf

Please help.

thx

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu localeconf Edit question
Assignee:
No assignee Edit question
Solved by:
Tong Sun
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

If you install localepurge, you can keep the locales you need and remove the rest. If that's what you need? Yu will be asked which locales you want and the system will remove what is not needed.

Revision history for this message
Tong Sun (suntong001) said :
#2

Hi actionparsnip,

Seems that you've never done such system locales configuration before.

What I want is for the system to recognize my zh locales, instead of that long list of en_?? locales that I will never use except for en_US.

Read the url that I posted you might get an idea.

Revision history for this message
Tong Sun (suntong001) said :
#3

How to select and generate locales on Ubuntu
http://www.ubuntugeek.com/how-to-select-and-generate-locales-on-ubuntu.html

For those of you who are used to running “dpkg-reconfigure locales” on Debian to select and generate locales you may be a bit disappointed at the seemingly broken way it is done under Ubuntu.

When I say broken “sudo dpkg-reconfigure locales” does not yield an interface that allows you to select and deselect locales. . .

Revision history for this message
Sam_ (and-sam) said :
#4
Revision history for this message
Frank Tesla (franktesla) said :
#5

Setting system wide locale for Ubuntu 10.10

1. - You could edit /etc/default/locale manualy and replace LANG and LANGUAGE with a valid encoding string like 'fr_CA.UTF-8' found in /usr/share/i18n/SUPPORTED ou use 'sudo update-locale' with valid encoding string.

2. - Edit /etc/environment and do the same

If you use GNOME interface you should update ~/.dmrc the same way.

It work well for me.

Revision history for this message
Tong Sun (suntong001) said :
#6

Thanks for the comments.

However, neither works.

Once again, this is my current locales:

$ locale -a
C
POSIX
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US
en_US.iso88591
en_US.utf8
en_ZA.utf8
en_ZW.utf8
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.utf8
zh_HK.utf8
zh_TW
zh_TW.big5
zh_TW.utf8

I want to remove that long list of en_XX locales that I will never use
except for en_US.

On Thu, Jan 27, 2011 at 1:15 PM, Frank Tesla <
<email address hidden>> wrote:

> Your question #130696 on localeconf in ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/localeconf/+question/130696
>
> Frank Tesla posted a new comment:
> Setting system wide locale for Ubuntu 10.10
>
> 1. - You could edit /etc/default/locale manualy and replace LANG and
> LANGUAGE with a valid encoding string like 'fr_CA.UTF-8' found in
> /usr/share/i18n/SUPPORTED ou use 'sudo update-locale' with valid
> encoding string.
>

Here is mine currently:

$ cat /etc/default/locale
LANG=en_US

>
> 2. - Edit /etc/environment and do the same
>

Here is mine currently:

cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

>
> If you use GNOME interface you should update ~/.dmrc the same way.
>

Nope, I don't use any desktop environment. Just window manager.

Thanks all the same.

BTW, I also went over what Samantha (aka
Sam)<https://launchpad.net/%7Eand-sam>said on
2010-10-22, but nothing worked as well.

cheers

Revision history for this message
Frank Tesla (franktesla) said :
#7

As i could see there no character encoding(UTF-8 or ISO88591) assign to your LANG environment variable. It a very important part since it tell the system how to display character (espcilialy in filename). So check /usr/share/i18n/SUPPORTED and copy/paste a string witch contain the character coding string, is your case is should be either en_US.ISO-8859-15 (for Windows compatibility) or en_US.UTF-8 (for the rest of the wolrd !!). Take care *** case is important ***. In my /usr/share/i18n/SUPPORTED encoding are in uppercase (look your to be sure).

There shoul be a LANGUAGE variable in /etc/default/locale. Here is mine:

cat /etc/default/locale
LANG="fr_CA.UTF-8"
LANGUAGE="fr_CA"

My /etc/environment
cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
#LANGUAGE="fr_CA"
#LANG="fr_CA.utf8"
LANGUAGE="fr_CA.UTF-8"
LANG="fr_CA.UTF-8"

Note: the commented line was the original lines put by Ubuntu installation *** but it didn't work **** because it was different (uft8 instead of UFT-8) for their equivalent in /usr/share/i18n/SUPPORTED

It just set locale system wide, i will check for get rid of other (but for me it doesn't really matter, it just use few Kb on the disk).

Of course. you should logout and login to reset you locale (reboot for system wide resetting).

> Nope, I don't use any desktop environment. Just window manager.

??? Could explain me that.

Hope it

Revision history for this message
Frank Tesla (franktesla) said :
#8

I may have find a way to keep just the locale you.

There is a locale-gen command. It a shell script that generate all locale file in /usr/share/i18n/SUPPORTED. So copy /usr/share/i18n/SUPPORTED to /usr/share/i18n/SUPPORTED.save (safety :)), edit it and keep just the line that define locales you want. Then sudo locale-gen --purge should do the job.

If not you could restore the orignal /usr/share/i18n/SUPPORTED and sudo locale-gen

Revision history for this message
Tong Sun (suntong001) said :
#9

On Fri, Jan 28, 2011 at 12:38 PM, Frank Tesla <
<email address hidden>> wrote:

> locale-gen --purge should do the job.
>

Oh, yep. That works like a charm.

So the issue really bog down to that Unbuntu doesn't have a proper default
for locale-gen.

In Debian, the purge is by default, which really makes sense -- e.g., when I
list 5 locales as my locales, I want that 5, and don't want any legacies get
into my way. When I remove locales from the config file, I want them to be
reomoved from the system locales as well.

Hope that can be fixed in the future.

Thanks