Friday, April 12, 2024
HomeGolangWhy does os.LookupEnv("LANG") choose the fallacious language? - Getting Assist

Why does os.LookupEnv(“LANG”) choose the fallacious language? – Getting Assist


	s, _ := os.LookupEnv("LANG")
	fmt.Println(s)

This offers en_US.UTF-8 which is much from my pc language setting. How can I get correct pc default language?

For Posix, a conference appears to be to make use of any of those atmosphere variables, so perhaps test for another ones:

  • LANGUAGE
  • LC_ALL
  • LC_MESSAGES, LC_NUMERIC, LC_TIME, LC_COLLATE, and others
  • LANG

(Supply)

On Home windows, I see LC_CTYPE=“en_US.UTF-8”, however there’s additionally a Home windows API perform to get that data: GetSystemDefaultUILanguage. I’m undecided if there’s an equal for different OSes

1 Like

It turned out that the terminal in VS Code ship one other outcome than the uncooked terminal. So VS Code is accountable on this case. I assumed that VS Code offers an accurate outcome. A particular thanks to @hollowaykeanho for enlighten me about this.

1 Like

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments