I am currently adding some locales to my extension and command names and configuration descriptions already work.
Now I want to add translations for error messages and popups inside my extension using vscode-nls. However it seems like it doesn't automatically determine the locale of vscode and I can't find any API for this in the documentation. Is there any way for extensions to do this yet or is it only for the built-in commands?
It turns out vscode has an API for this, to get the language you can use
vscode.env.language
. I guess just base everything around this because there is no actual way to get the locale except maybe on linux by using the locale environment variables. But for language usingvscode.env.language
should be the best way to get the language in case you override it through the settings file or if you want it to work on all platforms.