Change terminal locale without changing OS/GNOME locale

Hello!

So, I’m getting a wierd error within locale setup.

I want all terminal commands be in english, maintaining my OS in other language.
This is because I find myself strangely reading the command messages in my language, and understanding nothing :laughing:

My login shell is fish. I tried to change the LC_... variables to en_US.UTF-8, but after a reboot all OS is in English too. This happens if I do:

  1. localectl set-locale LC_MESSAGES=en_US.UTF8 and its variants
  2. set -g ... with or without -x (fish specific command)
  3. set -U ... with or without -x (fish specific command)

I opened a help issue in fish github for a workaround, but I think there is more behind this.

Also, I tried to change the shell only in terminal program, but I do not saw the option (neither in ptyxis nor console).

Can you help me with this please?

There should be an if block in the default Fish configuration (~/.config/fish/config.fish) that lets you run commands only in interactive sessions. You can set your locale inside that block so it won’t affect your user-wide locale.

if status is-interactive
    set -gx LC_ALL "en_US.UTF8"
end

from man locale.conf

   Example 1. German locale with English messages
   /etc/locale.conf:

       # Custom settings
       LANG=de_DE.UTF-8
       LC_MESSAGES=en_US.UTF-8

You are a genius!

I just made a simple alteration. Instead of set -gx, I choose set -g.
It worked like a charm! Now my shell is in english but my system stays in my tongue language.

Thank you!

1 Like