1

I've written some AppleScripts that run shell commands like lpstat -a and lpstat -l -p and parse the output with grep and awk. The scripts work correctly in English-language system, but the output is different in non-English systems.

The only workaround I've found is impractical: I have four strings that are different in English systems and non-English systems, so I've created variables that the script work in English and French. But it's impossible to do this for every language. So is there a way to force the output of lpstat to be in English, no matter what the system language is?

1 Answer 1

6

Looking through the Apple-modified version of cups/language.c (specifically, 10.6.8’s language.c), I found that you should be able to override the language by setting LANG to your preferred language as long as you also set SOFTWARE (any value, even the empty string).

https://unix.stackexchange.com/questions/33833/lpstat-and-localization-under-mac-os-x

So:

SOFTWARE= LANG=C lpstat -a
4
  • This is perfect! Thank you!
    – emendelson
    Commented Aug 28 at 21:25
  • One more question: What does LANG=C mean? Does it refer to the C programming language or is some way to refer to a human language? I suppose that it refers to the programming language, but I've never seen that kind of entry for LANG before.
    – emendelson
    Commented Aug 29 at 12:19
  • 1
    stackoverflow.com/questions/50614923/…
    – Linc D.
    Commented Aug 29 at 15:21
  • I should have found that myself. Thank you!
    – emendelson
    Commented Aug 29 at 21:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .