[ACCEPTED]-Selecting message language in gcc and g++-g++

Accepted answer
Score: 20

The end of the GCC manpage contains an overview 23 of its locale environment variables:

  • LANG
  • LC_ALL

These 22 environment variables control the way that 21 GCC uses localization information that allow 20 GCC to work with different national conventions. GCC 19 inspects the locale categories LC_CTYPE and LC_MESSAGES if 18 it has been configured to do so. These locale 17 categories can be set to any value supported 16 by your installation. A typical value is 15 en_GB.UTF-8 for English in the United Kingdom 14 encoded in UTF-8.

The LC_CTYPE environment variable 13 specifies character classification. GCC 12 uses it to determine the character boundaries 11 in a string; this is needed for some multibyte 10 encodings that contain quote and escape 9 characters that would otherwise be interpreted 8 as a string end or escape.

The LC_MESSAGES environment 7 variable specifies the language to use in 6 diagnostic messages.

If the LC_ALL environment 5 variable is set, it overrides the value 4 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES default 3 to the value of the LANG environment variable. If 2 none of these variables are set, GCC defaults 1 to traditional C English behavior.

I do this:

LC_MESSAGES=C gcc-command-here
Score: 5

To change the gcc translations to English, to 3 must set the environment variable LANG to 2 English:

$ export LANG=en

add it to your .profile 1 file and it will always be in English

More Related questions