What is my locale linux

locale (1) — Linux Manuals

The locale command displays information about the current locale, or all locales, on standard output.

When invoked without arguments, locale displays the current locale settings for each locale category (see locale(5)), based on the settings of the environment variables that control the locale (see locale(7)). Values for variables set in the environment are printed without double quotes, implied values are printed with double quotes.

If either the -a or the -m option (or one of their long-format equivalents) is specified, the behavior is as follows:

-a, —all-locales Display a list of all available locales. The -v option causes the LC_IDENTIFICATION metadata about each locale to be included in the output. -m, —charmaps Display the available charmaps (character set description files). To display the current character set for the locale, use locale -c charmap.

The locale command can also be provided with one or more arguments, which are the names of locale keywords (for example, date_fmt, ctype-class-names, yesexpr, or decimal_point) or locale categories (for example, LC_CTYPE or LC_TIME). For each argument, the following is displayed:

* For a locale keyword, the value of that keyword to be displayed. * For a locale category, the values of all keywords in that category are displayed.

When arguments are supplied, the following options are meaningful:

-c, —category-name For a category name argument, write the name of the locale category on a separate line preceding the list of keyword values for that category. For a keyword name argument, write the name of the locale category for this keyword on a separate line preceding the keyword value. This option improves readability when multiple name arguments are specified. It can be combined with the -k option. -k, —keyword-name For each keyword whose value is being displayed, include also the name of that keyword, so that the output has the format:
keyword

The locale command also knows about the following options:

-v, —verbose Display additional information for some command-line option and argument combinations. -?, —help Display a summary of command-line options and arguments and exit. —usage Display a short usage message and exit. -V, —version Display the program version and exit.

Читайте также:  Linux выбрать другой диск

FILES

/usr/lib/locale/locale-archive Usual default locale archive location. /usr/share/i18n/locales Usual default path for locale definition files.

CONFORMING TO

EXAMPLES

$ locale LANG=en_US.UTF-8 LC_CTYPE=»en_US.UTF-8″ LC_NUMERIC=»en_US.UTF-8″ LC_TIME=»en_US.UTF-8″ LC_COLLATE=»en_US.UTF-8″ LC_MONETARY=»en_US.UTF-8″ LC_MESSAGES=»en_US.UTF-8″ LC_PAPER=»en_US.UTF-8″ LC_NAME=»en_US.UTF-8″ LC_ADDRESS=»en_US.UTF-8″ LC_TELEPHONE=»en_US.UTF-8″ LC_MEASUREMENT=»en_US.UTF-8″ LC_IDENTIFICATION=»en_US.UTF-8″ LC_ALL=

$ locale date_fmt %a %b %e %H:%M:%S %Z %Y

$ locale -k date_fmt date_fmt=»%a %b %e %H:%M:%S %Z %Y»

$ locale -ck date_fmt LC_TIME date_fmt=»%a %b %e %H:%M:%S %Z %Y»

$ locale LC_TELEPHONE +%c (%a) %l (%a) %l 11 1 UTF-8

$ locale -k LC_TELEPHONE tel_int_fmt=»+%c (%a) %l» tel_dom_fmt=»(%a) %l» int_select=»11″ int_prefix=»1″ telephone-codeset=»UTF-8″

The following example compiles a custom locale from the ./wrk directory with the localedef(1) utility under the $HOME/.locale directory, then tests the result with the date(1) command, and then sets the environment variables LOCPATH and LANG in the shell profile file so that the custom locale will be used in the subsequent user sessions:

$ mkdir -p $HOME/.locale $ I18NPATH=./wrk/ localedef -f UTF-8 -i fi_SE $HOME/.locale/fi_SE.UTF-8 $ LOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date $ echo «export LOCPATH=\$HOME/.locale» >> $HOME/.bashrc $ echo «export LANG=fi_SE.UTF-8» >> $HOME/.bashrc

COLOPHON

This page is part of release 5.10 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.

SEE ALSO

  • locale (0p) — category macros
  • locale (1p) — get locale-specific information
  • locale (5) — describes a locale definition file
  • locale (7) — description of multilanguage support
  • perllocale (1) — Perl locale handling (internationalization and localization)

Источник

How to Change System Language (Locale) in Ubuntu and Debian?

Locale settings determine the operating system language and regional settings used in the terminal and in the graphical interface (date and time format, currency symbols, available character sets, etc.). This article will look at how to check or set locale settings on Linux distros (Ubuntu, Debian, Mint, etc.).

You can list the current locale settings in Ubuntu and Debian using the command:

get locale in ubuntu linux

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

List of available locales on the host:

list available system locales

To display detailed information about the locales installed on the current Linux host:

The C.UTF-8 system locale is always present in this list. Let’s try to add the German locale de_DE.UTF-8.

The list of locales available for installation is listed in the file:

Читайте также:  My domain on Apache!

To install the locale you need, run the command:

locale-gen - generate new locale fles

You can also enable locales you need by uncommenting the lines in the file /etc/locale.gen:

/etc/locale.gen

To set the default locale, use the command:

$ sudo update-locale LANG=de_DE.UTF-8
$ sudo localectl set-locale LANG=de_DE.UTF-8

This command will write the following line to the /etc/default/locale:

Reboot the Linux host to apply the new locale settings.

You can set a separate locale for different parts of Linux, for example:

$ sudo update-locale LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_MONETARY=en_US.UTF-8

If you specify a locale that has not yet been generated, the locale command will return errors:

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
LANG=fr_FR.utf8

In some cases, you must first set the required locale:

$sudo apt-get install language-pack-fr

If the locale is not set on Linux and the locale -a command returns only three entries:

    You need to generate new locale settings:

sudo update-locale LANG=de_DE.UTF-8

For easier locale management on Debian and Ubuntu, you can use the dpkg-reconfigure tool.

With the following command you can generate, set, or remove locales on Linux:

$ sudo dpkg-reconfigure locales

The utility provides a simple pseudo-graphical interface. Select the locales to install.

dpkg-reconfigure locales

Then set the default locale (default locale for the system environment).

dpkg-reconfigure set default locale for the system environment

To change the encoding in the console (terminal), run the command:

$ sudo dpkg-reconfigure console-setup

Select UTF-8 encoding for the console, then choose which character set support to add.

dpkg-reconfigure console-setup

These settings are stored in:

$ cat /etc/default/console-setup

Then configure the keyboard:

$ sudo dpkg-reconfigure keyboard-configuration

The default recommended keyboard model is Generic 105-key PC. Then add the keyboard mappings (keymaps) for the desired country.

Keyboard settings are specified in the file:

It remains to set the time zone:

$ sudo dpkg-reconfigure tzdata

You can remove locales you don’t use. The list of installed locales is in /usr/lib/locale/locale-archive.

List the locales in the archive:

delete locales in linux with localedef

$ sudo localedef --delete-from-archive en_IN.utf8

Источник

How to Change or Set System Locales in Linux

A locale is a set of environmental variables that defines the language, country, and character encoding settings (or any other special variant preferences) for your applications and shell session on a Linux system. These environmental variables are used by system libraries and locale-aware applications on the system.

Читайте также:  Find найти файл линукс

Locale affects things such as the time/date format, the first day of the week, numbers, currency and many other values formatted in accordance with the language or region/country you set on a Linux system.

In this article, we will show how to view your currently installed system locale and how to set system’s locale in Linux.

How to View System Locale in Linux

To view information about the current installed locale, use the locale or localectl utility.

$ locale LANG=en_US.UTF-8 LANGUAGE=en_US LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= $ localectl status System Locale: LANG=en_US.UTF-8 LANGUAGE=en_US VC Keymap: n/a X11 Layout: us X11 Model: pc105

You can view more information about an environmental variable, for example LC_TIME, which stores the time and date format.

$ locale -k LC_TIME abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat" day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday" abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec" mon="January;February;March;April;May;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" era= era_year="" era_d_fmt="" alt_digits= era_d_t_fmt="" era_t_fmt="" time-era-num-entries=0 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-8" alt_mon="January;February;March;April;May;June;July;August;September;October;November;December" ab_alt_mon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"

To display a list of all available locales use the following command.

$ locale -a C C.UTF-8 en_US.utf8 POSIX

How to Set System Locale in Linux

If you want to change or set system local, use the update-locale program. The LANG variable allows you to set the locale for the entire system.

The following command sets LANG to en_IN.UTF-8 and removes definitions for LANGUAGE.

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

To configure a specific locale parameter, edit the appropriate variable. For instance.

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

You can find global locale settings in the following files:

  • /etc/default/locale – on Ubuntu/Debian
  • /etc/locale.conf – on CentOS/RHEL

These files can also be edited manually using any of your favorite command line editors such as Vim or Nano, to configure your system locale.

To set a global locale for single user, you can simply open ~/.bash_profile file and add the following lines.

LANG="en_IN.utf8" export LANG

For more information, see the locale, update-locale and localectl man pages.

$ man locale $ man update-locale $ man localectl

That’s all! In this short article, we have explained how to view and set system local in Linux. If you have any questions, use the feedback form below to reach us.

Источник

Оцените статью
Adblock
detector