s, _ := os.LookupEnv("LANG")
fmt.Println(s)
This gives en_US.UTF-8 which is far from my computer language setting. How can I get accurate computer default language?
s, _ := os.LookupEnv("LANG")
fmt.Println(s)
This gives en_US.UTF-8 which is far from my computer language setting. How can I get accurate computer default language?
For Posix, a convention seems to be to use any of these environment variables, so maybe check for some other ones:
(Source)
On Windows, I see LC_CTYPE=“en_US.UTF-8”, but there’s also a Windows API function to get that information: GetSystemDefaultUILanguage. I’m not sure if there’s an equivalent for other OSes
It turned out that the terminal in VS Code deliver another result than the raw terminal. So VS Code is to blame in this case. I assumed that VS Code gives a correct result. A special thank you to @hollowaykeanho for enlighten me about this.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.