Change system language linux

Changing Linux System Language (Locales) From Command Line on Ubuntu and Debian Based Distros

It’s been some time since I wrote something on It’s FOSS. The truth is that I’ve been writing for a Spanish version of It’s FOSS. If you’ve not visited it and/or you’re a Spanish speaker, please visit It’s FOSS en Español and check all the Linux content in Spanish.

You may be wondering why I’m sharing this fact with you. It’s because this post includes this new page as an example.

At the time of doing a clean installation of your favorite Linux distro, the system asks you to choose a main language. Even though it’s not frequent, some people consider changing that language to a new one later on, like me for example.

See, I have to take screenshots in both Spanish (for It’s FOSS en Español) and in English (for It’s FOSS). This becomes a problem, because I have only one computer, and changing the user is not a fast solution for me.

That’s why I’d like to share with you this quick tip, where I’ll show you how to change your main system language with two simple lines in the terminal.

Changing Linux system language from the terminal

Let’s suppose you want to change your main language from English to Spanish.

Verify which language you have set as default (main language). For this, let’s use the locale command.

You should see something like this.

[email protected]:~$ locale 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=

Here you can see that the main language is English. Now to change it, use the dpkg command in this fashion:

sudo dpkg-reconfigure locales

Once you run the command before, you should see the next screen in your terminal.

sudo dpkg reconfigure locales

Here, you should move using the up and down arrow until you reach the desired language. In my case, I desire Spanish, and more specific, Mexican Spanish because I’m Mexican.

Not all languages may have the options, but if yours have, opt for UTF-8.

Once your language has been found, press the SPACE KEY to mark it and then ENTER.

Читайте также:  Ms teams arch linux

selecting your language

Finally, select this new language as your default by moving to it using the arrow key and pushing the ENTER KEY, in the last windows.

setting new language as default 1

Once done, you should see a message like this in your terminal:

Generating locales (this might take a while). en_US.UTF-8. done es_MX.UTF-8. done Generation complete.

And that’s all! Now you’re able to change your default language as many times you want directly from the terminal.

Please let us know if you have any doubt about this topic in the comments section. Good look!

Источник

Как поменять язык Linux без переустановки системы

При установке Linux можно выбрать язык системы (локаль) — и в дальнейшем этот язык будет использоваться в программах и окнах Linux (за исключением тех приложений, для которых не сделан перевод).

Если вы решили поменять язык Linux, то вам не нужно переустанавливать её — достаточно выполнить простые действия.

Чтобы узнать текущие языковые настройки, наберите команду:

Чтобы посмотреть доступные языковые настройки (локали), воспользуйтесь командой

Для изменения языка системы, нужно, чтобы локаль, на которую вы хотите поменять язык, уже присутствовала в системе. Если её нет, то нужно добавить.

Чтобы добавить новую локаль, откройте файл /etc/locale.gen:

И раскомментируйте там строки с желаемыми новыми локалями. Затем выполните команду:

Теперь новые языковые настройки (новую локаль) вы можете видеть в списке доступных локалей.


Смена локали для текущий сессии

Чтобы поменять язык и кодировку для текущей сессии, вам нужно установить переменную окружения LANG, это можно сделать командой export:

# Установить английскую локаль export LANG=en_US.UTF-8 # Установить русскую локаль export LANG=ru_RU.UTF-8 # Установить французскую локаль export LANG=fr_FR.UTF-8

Если в вашей системе это не сработало, то замените переменную LANG на переменную LANGUAGE, например:

Изменение языковых настроек насовсем для одного пользователя

Добавьте строку с экспортом желаемой локали (например, export LANG=en_US.utf-8) в файл ~/.bashrc

Изменения начнут действовать после выхода/входа и будут действовать после каждой перезагрузки.

Изменение системной локали по умолчанию

Есть два альтернативных метода смены локали.

Первый — это запустить следующую команду (укажите нужную вам локаль):

sudo localectl set-locale LANG=en_US.UTF-8
sudo localectl set-locale LANG=ru_RU.UTF-8

Второй метод — прописать язык в файле /etc/locale.conf, откройте его:

и добавьте туда строку с нужной локалью:

После перезагрузки система предложит изменить имена папок на локализованные:

Чтобы это окно не появлялось при каждой загрузке системы, поставьте галочку «Не задавать больше этот вопрос».

Чтобы вновь открыть это окно, выполните в командной строке:

echo 'en_US' > ~/.config/user-dirs.locale xdg-user-dirs-gtk-update

Источник

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.

Читайте также:  Cisco packet tracer linux manjaro

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.

Источник

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.).

Читайте также:  What is linux mint cinnamon and mate

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:

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

Источник

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