4

Is there a way I can change the language of the console? I have seen things such as adding LANG=C in front of the commands but that is a temporary fix.

I can live with the Turkish console but when it comes to man and help commands it drives me nuts. I do not understand the Turkish terms used.

3 Answers3

2

Run the following command to save it in your ~/.bashrc file so that every time you open an interactive non-login terminal your locale will be set accordingly:

echo 'export LANG=C' >> ~/.bashrc

Note that the C locale uses an ASCII character set, if you want Unicode then use a locale that supports it e.g.:

echo 'export LANG=en_US.UTF-8' >> ~/.bashrc

To make changes available from the running session, source the ~/.bashrc file:

source ~/.bashrc
heemayl
  • 91,753
  • What about the login terminal? I really don't use the non-login terminal. – utkumaden Jun 18 '15 at 19:35
  • @utkumaden In case of login interactive terminals, just replace ~/.bashrc with ~/.profile – heemayl Jun 18 '15 at 19:37
  • 1
    @heemayl I think for most tasks that the user needs, ~/.bashrc will be sufficient. It works for be in both ttys and graphical terminal,so . . . – Sergiy Kolodyazhnyy Jun 18 '15 at 19:39
  • @Serg ~/.bashrc is for non-login shells..OP mentioned in the previous comment they use login shell.. – heemayl Jun 18 '15 at 19:41
  • I wish it would have worked. It did not. I checked the non login terminal. It did work there. I might want to try @Serg 's answer for this. – utkumaden Jun 18 '15 at 19:52
  • @utkumaden can you give the exact command you have tried? also login terminal means consoles, are we right over there? – heemayl Jun 18 '15 at 19:54
  • @heemayl Well I did sudo gedit ~/.profile. then added export LANG=en_US.UTF-8 at the end – utkumaden Jun 18 '15 at 20:01
  • @utkumaden no..no sudo..sudo means you are changing the ~/.profile for root....just use gedit ~/.profile and add the line..also run source ~/.profile after that.. – heemayl Jun 18 '15 at 20:04
  • basically, you need to both add the line to the file and then update your shell with the source command – Sergiy Kolodyazhnyy Jun 18 '15 at 20:05
  • Even without sudo, it didn't work. Maybe it is because I screwed with it using sudo. I don't know what to do. And no, I did not stack export LANG=en_US.UTF-8 over each other. I will try removing the lines using sudo then if the lines are still present in .profile I will remove it form there too. Then follow these instructions as is. I will return if I get anymore problems. – utkumaden Jun 18 '15 at 20:19
  • And as I guessed nothing happened. I will have to live with it then. Dang linux, this is one thing that puts me off from linux. – utkumaden Jun 18 '15 at 20:23
  • @utkumaden if you are using sudo you are changing .profile of root, not the normal user..i am not clear what changes you have made actually..although changing the ~/.profile is the ideal way, just saving it in ~/.bashrc would do as ~/.profile has a stanza to source the ~/bashrc from it..but this not the right way to put non-login shells stuffs in ~/.bashrc because not all shells has the stanza and anyone can remove that stanza to keep a different envitonment for two cases..remove the entries you have added to ~/.profile, run the commands i have given with ~/.profile – heemayl Jun 18 '15 at 20:28
  • @utkumaden on a different note, try export LC_ALL=en_US.UTF-8 instead as LC_ALL takes predence over them all.... – heemayl Jun 18 '15 at 20:33
  • @heemayl: It does not take precedence over the LANGUAGE variable, which is what needs to be changed, unless LANG or LC_ALL is set to C. – Gunnar Hjalmarsson Jun 18 '15 at 20:38
  • @GunnarHjalmarsson I did not know that..also man bash and man locale do not have it..could you please share a reference.. – heemayl Jun 18 '15 at 20:42
  • @heemayl: It's a gettext thing. – Gunnar Hjalmarsson Jun 18 '15 at 20:45
0

Put that into your ~/.bashrc file, where you define the prompt. Example:

PS1='$(LANG=C)serg@ubuntu $ '

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • Were exactly does that line go? I can't find where I am supposed to add it. – utkumaden Jun 18 '15 at 19:21
  • So, basically in your homefolder, you can create .bashrc file, which is read by bash every time you open terminal. For example, I use it to define my prompt as PS1=' serg@ubuntu '. If I want a command to be run there every time I open terminal or run something in terminal, I add $( command ) to that PS1='serg@ubuntu' line, just like i showed. – Sergiy Kolodyazhnyy Jun 18 '15 at 19:31
0

I have a file in my ~/bin folder to get gnome-terminal in English:

$ cat ~/bin/gnome-terminal
#!/bin/sh
export LANGUAGE=en_US
exec /usr/bin/gnome-terminal $@

(~/bin is the first item in $PATH if it exists)

Please note that since the LANGUAGE variable is set more often than not in Ubuntu, and since gnome-terminal uses gettext, it's LANGUAGE which needs to be changed, not LANG.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94