Linux How-To

The right way to Change or Set System Locales in Linux

SEOClerks

A locale is a set of environmental variables that defines the language, nation, and character encoding settings (or some other particular variant preferences) to your purposes and shell session on a Linux system. These environmental variables are utilized by system libraries and locale-aware purposes on the system.

Locale impacts issues such because the time/date format, the primary day of the week, numbers, foreign money and plenty of different values formatted in accordance with the language or area/nation you set on a Linux system.

On this article, we are going to present tips on how to view your presently put in system locale and tips on how to set system’s locale in Linux.

The right way to View System Locale in Linux

To view details about the present put in locale, use the locale or localectl utility.

$ locale

LANG=en_US.UTF-Eight
LANGUAGE=en_US
LC_CTYPE=”en_US.UTF-Eight”
LC_NUMERIC=”en_US.UTF-Eight”
LC_TIME=”en_US.UTF-Eight”
LC_COLLATE=”en_US.UTF-Eight”
LC_MONETARY=”en_US.UTF-Eight”
LC_MESSAGES=”en_US.UTF-Eight”
LC_PAPER=”en_US.UTF-Eight”
LC_NAME=”en_US.UTF-Eight”
LC_ADDRESS=”en_US.UTF-Eight”
LC_TELEPHONE=”en_US.UTF-Eight”
LC_MEASUREMENT=”en_US.UTF-Eight”
LC_IDENTIFICATION=”en_US.UTF-Eight”
LC_ALL=

$ localectl standing

System Locale: LANG=en_US.UTF-Eight
LANGUAGE=en_US
VC Keymap: n/a
X11 Format: us
X11 Mannequin: computer105

You possibly can view extra details about an environmental variable, for instance LC_TIME, which shops the time and date format.

$ locale -k LC_TIME

abday=”Solar;Mon;Tue;Wed;Thu;Fri;Sat”
day=”Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday”
abmon=”Jan;Feb;Mar;Apr;Might;Jun;Jul;Aug;Sep;Oct;Nov;Dec”
mon=”January;February;March;April;Might;June;July;August;September;October;November;December”
am_pm=”AM;PM”
d_t_fmt=”%a %d %b %Y %r %Z”
d_fmt=”%m/%d/%Y”
t_fmt=”%r”
t_fmt_ampm=”%I:%M:%S %p”
period=
era_year=””
era_d_fmt=””
alt_digits=
era_d_t_fmt=””
era_t_fmt=””
time-era-num-entries=zero
time-era-entries=”S”
week-ndays=7
week-1stday=19971130
week-1stweek=1
first_weekday=1
first_workday=2
cal_direction=1
timezone=””
date_fmt=”%a %b %e %H:%M:%S %Z %Y”
time-codeset=”UTF-Eight”
alt_mon=”January;February;March;April;Might;June;July;August;September;October;November;December”
ab_alt_mon=”Jan;Feb;Mar;Apr;Might;Jun;Jul;Aug;Sep;Oct;Nov;Dec”

To show an inventory of all out there locales use the next command.

$ locale -a

C
C.UTF-Eight
en_US.utf8
POSIX

The right way to Set System Locale in Linux

If you wish to change or set system native, use the update-locale program. The LANG variable lets you set the locale for your complete system.

The next command units LANG to en_IN.UTF-Eight and removes definitions for LANGUAGE.

$ sudo update-locale LANG=LANG=en_IN.UTF-Eight LANGUAGE
OR
$ sudo localectl set-locale LANG=en_IN.UTF-Eight

To configure a particular locale parameter, edit the suitable variable. As an example.

$ sudo update-locale LC_TIME=en_IN.UTF-Eight
OR
$ sudo localectl set-locale LC_TIME=en_IN.UTF-Eight

You could find world locale settings within the following information:

/and so forth/default/locale – on Ubuntu/Debian
/and so forth/locale.conf – on CentOS/RHEL

These information can be edited manually utilizing any of your favourite command line editors similar to Vim or Nano, to configure your system locale.

To set a worldwide locale for single person, you’ll be able to merely open ~/.bash_profile file and add the next traces.

LANG=”en_IN.utf8″
export LANG

For extra data, see the locale, update-locale and localectl man pages.

$ man locale
$ man update-locale
$ man localectl

That’s all! On this brief article, now we have defined tips on how to view and set system native in Linux. When you’ve got any questions, use the suggestions kind under to achieve us.

Source link

Related Articles

Leave a Reply

Back to top button