Forcing a script to run in english


My Mac is running Mavericks in English, but because my region is set to Portugal and my keyboard is the portuguese one, when I run some scripts they shows messages in portuguese. I generally hate to run software created by non-native people in Portuguese because the translation is always crappy. I end with messages like "cubra is not defined". What the hell is a "cubra"?

So, these scripts are reading something from the system and switching to portuguese. Is there a way to force them to always run in english?

My terminal has this option selected:

Terminal > Preferences > Settings > [profile] > Advanced > Set locale environment variables on startup

Best Answer

It depends upon the program. If it uses gettext which is a common library for doing internationalization then setting the LANG environment variable to en_US (or en_UK if you want British Enligh vs. American English) should do the trick.

If you only want specific applications to use english messages then you can alias the command to something like LANG=en_US command-you-want-in-english.

Aliasing is dependant upon which shell you are using but in bash (the default shell on MacOSX) you would put the following command in your .bashrc or .bash_profile:

alias command='LANG=en_US command'

When in doubt - look to the man page or manual for the command you are running to see if they give details on how their internationalization is implemented and how you as a user can control it.