如何在 Windows 中设置 LANG 变量?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1180590/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:51:45  来源:igfitidea点击:

How to set LANG variable in Windows?

pythonwindowslocale

提问by b3rx

I'm making an application that supports multi language. And I am using gettextand localeto solve this issue.

我正在制作一个支持多语言的应用程序。我正在使用gettextlocale来解决这个问题。

How to set LANG variable in Windows? In Linux and Unix-like systems it's just as simple as

如何在 Windows 中设置 LANG 变量?在 Linux 和类 Unix 系统中,它就像

$ LANG=en_US python appname.py

$ LANG=en_US python appname.py

And it will automatically set the locale to that particular language. But in Windows, the

它会自动将语言环境设置为该特定语言。但在 Windows 中,

C:\>SET LANG=en_US python appname.py

C:\>SET LANG=en_US python appname.py

or

或者

C:\>SET LANG=en_US

C:\>SET LANG=en_US

C:\>python appname.py

C:\>python appname.py

doesn't work.

不起作用。

回答by Pavel Minaev

Windows locale support doesn't rely on LANG variable (or, indeed, any other environmental variable). It is whatever the user set it to in Control Panel.

Windows 语言环境支持不依赖于 LANG 变量(或实际上,任何其他环境变量)。它是用户在控制面板中设置的任何内容。

回答by tsvikas

you can use a batch file like in here: http://www.geany.org/Documentation/FAQ#QQuestions11

您可以使用如下所示的批处理文件:http: //www.geany.org/Documentation/FAQ#QQuestions11

set LANG=en_US
something.exe

or set it through the control panel / system / advanced system settings / advanced / environmental variables

或者通过控制面板/系统/高级系统设置/高级/环境变量设置