Thursday, July 23, 2009

Change locale in ubuntu

Sometimes we need to change the locale for some testing purpose or general shift to new. To change the locale in Windows is accomplished by Control Panel -> Regional Settings.

To change the same in the Ubuntu there are set of commands available.

To see current locale open terminal and run command 'locale'

If you know the locale you want to change to you should do following steps

1.add the locale in /var/lib/locales/supported.d/local
Eg : en_US.UTF-8

2. Regenerate the locale
dpkg-reconfigure locales

3. update locale using
update-locale LANG=en_US.UTF-8

Reboot the machine and again check the locale. It will be changed.

If you want to see the lost of supported locale
open /usr/share/i18n/SUPPORTED

We can make all the locales. Open terminal and run following commands

xyz@local: sudo su
root@local: cat /usr/share/i18n/SUPPORTED > /var/lib/locales/supported.d/local
root@local: dpkg-reconfigure locales
root@local: update-locale LANG=en_US.UTF-8

Reboot the machine and we are done.

Note : It will change the language of the PC so be careful Don't use this unless you are sure what you are about to do. In any case you can again set your locale to default and reboot.



1 comment: