是否可以在运行时设置 Windows 程序的语言或区域设置?
我们有一些现有的软件(C++ Windows 应用程序),它们的资源已被翻译成多种语言供不同的客户使用。该应用程序从 Windows 区域设置中获取区域设置并以适当的语言运行。
根据最近的订单,我们将资源翻译成德语,但我们刚刚发现客户正在安装英语版 Windows,但希望我们的软件仍以德语运行。显然,PC上运行的其余软件还没有全球化,而且只是德语。
在 Windows 中是否有任何方法可以覆盖区域设置,以便软件认为它在德语安装的 Windows 上运行?我们现在没有时间对软件进行更改以覆盖区域设置,并且无论如何也不愿意为该客户分叉该应用程序。
有什么建议吗?
We have some existing software (C++ Windows applications) that have had their resources translated into a number of languages for various customers. The application picks up the locale from the Windows locale and runs in the appropriate language.
Following a recent order, we translated the resources into German, however we have just found out that the customers are installing Windows in English, but want our software to still run in German. Apparently the rest of the software running on the PC has not been globalized and is only German.
Is there any way in Windows that we can override the locale so that the software believes it is running on a German install of Windows? We do not now have time to make changes to the software to override the locale, and would be reluctant to fork the application for this one customer anyway.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道有什么不涉及更改程序的简单方法,但我可以提供以下解决方法。
在运行应用程序的计算机上:
psexec
)。然后,程序将以德语语言环境运行,而用户将继续在英语环境中工作。
缺点
不过,如果用户尝试保存或打开文件,这会很烦人 - 桌面和文档文件夹将是德语用户的,而不是英语用户的。
I don't know of any straightforward way that does not involve changing your program, but I can offer the following workaround.
On the machines where your app is running:
psexec
).The program will then run with the German locale, while the user will keep working on an English environment.
Drawbacks
This is going to be annoying, though, if the user tries to save or open files - the desktop and documents folder are going to be those of the German user rather than the English one.
是的,您可以使用 WinMain 中的 win32 调用 SetThreadLocale 或应用程序的任何入口点。任何子线程都将继承父区域设置。详细信息请参见:
http:// msdn.microsoft.com/en-us/library/windows/desktop/dd374051%28v=vs.85%29.aspx
Yes you can use the win32 call SetThreadLocale from WinMain or whatever the entry point of your application is. Any child threads will inherit the parent locale. Details here:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd374051%28v=vs.85%29.aspx