问题描述
我有4种不同语言的WinForms应用程序.整个应用程序都是用英语编写的,但是我从未将Localization设置为en或en-US.有没有一种方法可以从代码强制将Language属性设置为(默认).例如,假设当前线程是葡萄牙语,我关闭所有表单,更改当前线程的CultuInfo以使用(默认)语言,然后再次重新加载所有表单.有办法吗?
I have a WinForms app in 4 different languages. The whole app was written in English, but I never set the Localization to en, or en-US. Is there a way to use to force the Language property to (default) from code. For instance, let's say that the current thread is in Portuguese, I close all forms, change the CultuInfo of the current thread to use the (default) language and reload all forms again. Is there a way o doing that?
谢谢
推荐答案
我猜您正在搜索 NeutralResourcesLanguage
类.您可以在AssemblyInfo.cs
文件中使用此属性来设置应用程序的默认区域性:
I guess you are searching for the NeutralResourcesLanguage
class. You use this attribute in your AssemblyInfo.cs
file to set the default culture of an application:
[assembly: NeutralResourcesLanguage("en-US")]
希望有帮助.
这篇关于如何强制可本地化的WinForms应用程序使用(默认)Language属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!