I need to detect the current locale in OS X from the command line. On Linux/Unix I can rely on LANG, but it is not always set:
http://henrik.nyh.se/2007/10/displaying-utf-8-correctly-in-leopard-terminal
I am looking for command line utilities or AppleScript code that allows me to find that information. Ideally they would work from 10.2 onwards
The closest I have found so far is
defaults read -g AppleLocale
which works on 10.3 onwards
apropos yeilds the command locale
10.4 and later though
Edit:
defaults read .GlobalPreferences AppleLanguages | tr -d [:space:] | cut -c2-3
is mentioned here. I don't have access to a 10.2 system though, so I don't know if it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With