How can I change language but only for the terminal?
Tl; dr
since you want to set everything to English (assuming that programs using GNU gettext should use Greek as a fallback language):
export LANG=en_US.UTF-8
export LANGUAGE=en:el
Or if some LC_*
variables are defined already in your shell's environment and you wish to override them:
export LC_ALL=en_US.UTF-8
export LANGUAGE=en:el
To make the settings stick, add the export
s at the end of ~/.bashrc
.
Changing /etc/default/locale
will affect the whole system's locale and consequently the locale of all users who didn't set a specific locale, so you shouldn't change it if you want to change only the language of the command running in your user's terminal / console.
The locale of the commands running in your user's terminal / console can be changed by exporting the following environment variables:
LANG
LANGUAGE
LC_ADDRESS
LC_ALL
LC_COLLATE
LC_CTYPE
LC_IDENTIFICATION
LC_MEASUREMENT
LC_MESSAGES
LC_MONETARY
LC_NAME
LC_NUMERIC
LC_PAPER
LC_TELEPHONE
LC_TIME
LANG
defines the value to be used for each non-explicitly defined LC_*
variable; so if none of the LC_*
variables is currently defined in your shell's environment (that is the default behavior, if env | grep '^LC_'
doesn't output anything it means that's the case) and you wish to set the value of all the categories to en_US.UTF-8
, simply export LANG
:
export LANG=en_US.UTF-8
Otherwise you'll have to either also override each previously defined LC_*
variable or (alternatively, more easily) just export LC_ALL
, which overrides any previously defined LC_*
variable:
export LC_ALL=en_US.UTF-8
However programs using GNU gettext will rely on LANGUAGE
rather than LANG
/ LC_ALL
(unless LANG
/ LC_ALL
is set to C
) and will set the language based on its content. LANGUAGE
should define a list of colon-separated languages. If a translation for the first colon-separated language listed is not available, the program will try to use to the second colon-separated language listed etc; for example, to set English as the preferred language and Greek as a fallback language:
export LANGUAGE=en:el
So in your case, since you want to set everything to English (assuming that programs using GNU gettext should use Greek as a fallback language):
export LANG=en_US.UTF-8
export LANGUAGE=en:el
Or if some LC_*
variables are defined already in your shell's environment and you wish to override them:
export LC_ALL=en_US.UTF-8
export LANGUAGE=en:el
To make the settings stick, add the export
s at the end of ~/.bashrc
.
Related videos on Youtube
OJeik
Updated on September 18, 2022Comments
-
OJeik almost 2 years
How do I change the language of the terminal to English?
I am familiar with using
vi
.If the terminal language is controlled by
etc/default/locale
, what am I supposed to change there?LANG="el_GR.UTF-8" LANGUAGE="el:en" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_IDENTIFICATION="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"