是否可以在运行时设置 Windows 程序的语言或区域设置?

发布于 2024-12-09 15:00:53 字数 313 浏览 1 评论 0原文

我们有一些现有的软件(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝海似她心 2024-12-16 15:00:53

我不知道有什么不涉及更改程序的简单方法,但我可以提供以下解决方法。

在运行应用程序的计算机上:

  1. 创建另一个用户,
  2. 将该用户的区域设置设置为德语
  3. 然后,让您的程序使用该用户的凭据运行(使用 runas 或 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:

  1. create another user
  2. set that user's locale to German
  3. Then, have your program run with that user's credentials (using runas or 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.

酒废 2024-12-16 15:00:53

是的,您可以使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文