When I start a Terminal (in Monterey 12.2.1) my LANG is sv_SE.UTF-8, which is fine.

When I start a shell, or any other sub-process that reads environment, from GUI Emacs it is set to LANG="en_SE.UTF-8", which obviously is incorrect.

As I understand it, Terminal, with "set enviroment variables on startup" activated in the preferences, will construct LANG from your "Language & Region" settings. There I have Swedish as the primary language, English as secondary and Sweden as the Region.

But obviously there is some similar mechanism when reading the environment from a GUI application, but for some reason it gets it wrong.

In a Terminal all other locale is also set to sv_SE.UTF-8. In the GUI shell they are set to C, indicating that they are unset, rather than inherited from LANG.

What's even more strange is that defaults read -g AppleLocale in a GUI shell gives sv_SE...

Why is this, is it a bug or can I fix so that LANG is set correctly also in GUI environment?


You must log in to answer this question.