2

I have message from bash and it's localized, I want English message, my locale is:

$ locale
LANG=pl_PL.UTF-8
LANGUAGE=pl:en
LC_CTYPE="pl_PL.UTF-8"
LC_NUMERIC=pl_PL.UTF-8
LC_TIME=pl_PL.UTF-8
LC_COLLATE="pl_PL.UTF-8"
LC_MONETARY=pl_PL.UTF-8
LC_MESSAGES="pl_PL.UTF-8"
LC_PAPER=pl_PL.UTF-8
LC_NAME=pl_PL.UTF-8
LC_ADDRESS=pl_PL.UTF-8
LC_TELEPHONE=pl_PL.UTF-8
LC_MEASUREMENT=pl_PL.UTF-8
LC_IDENTIFICATION=pl_PL.UTF-8
LC_ALL=

I've try:

LANG=en_US.UTF-8; type grunt
LC_ALL=en_US.UTF-8; type grunt
LC_MESSAGES=en_EN.UTF-8 && type grunt
export LC_MESSAGES=en_US.UTF-8; type grunt 

But the message keep showing up in Polish:

ścieżka do grunt jest zapamiętana (/usr/local/bin/grunt)

How can I make this text English?

EDIT

I've run:

$ eval $(locale | sed -e 's/\(.*\)=.*/export \1=en_US.UTF-8/')             
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
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=en_US.UTF-8

and type grunt show polish message.

6

The problem is your semicolon/&&. The way you're doing it, the shell is executing your assignment as a separate command. Thus, type is never seeing it. Do it this way instead:

LC_ALL=en_US.UTF-8 type grunt

This tells your shell to temporarily set the environment variable LC_ALL=en_US.UTF-8, execute type, then reset LC_ALL to whatever it was before.

  • It's strange, I think someting is wrong with type command because it's keep showing me translated message. – jcubic Mar 25 '14 at 19:16
  • @jcubic it may be due to the fact that type is a built-in. I'm not sure. – strugee Mar 26 '14 at 6:07
  • Also LC_ALL=en_US.UTF-8 xxx give localized file not found message. But when I run eval $(locale | sed -e 's/\(.*\)=.*/export \1=en_US.UTF-8/') it give me english one, maybe you need to use different variable for that too, I've tried LC_MESSAGES=en_US.UTF-8 xxx and it also give Polish not found message. – jcubic Mar 26 '14 at 8:07
  • @jcubic try LC_ALL=C or LANG=C – strugee Mar 26 '14 at 15:40
  • LANG x return localized message but LANG=C bash -c "x" give english one. LC_ALL=C bash -c "x" also work. – jcubic Mar 26 '14 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.