On my somewhat creaky MBP running Yosemite, I find that the POSIX environment variables for controlling the locale (LANG
and LC_*
) are properly set inside Terminal windows...
$ printenv | grep -E '^(LANG|LC_)'
LANG=en_US.UTF-8
$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
... but they are not properly set in the environment provided to GUI applications; for instance, inside an Emacs shell window, the above commands print
$ printenv | grep -E '^(LANG|LC_)'
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
How do I ensure that every process running on the computer, regardless of how it was started sees the proper LANG= environment setting? Bonus points for an answer that doesn't need manual action to stay in sync with the language settings in System Preferences.
(Related questions: Where does $LANG variable gets set in Mac OS X? indicates that it is Terminal.app that reflects the language settings from System Preferences to the shell's environment. Where are system environment variables set in Mountain Lion? suggests that the proper way to make manual global environment settings keeps getting changed with each new version of the operating system, yuck.)
open -a Emacs
– fd0 Jun 22 '16 at 20:16