WinForms 动态本地化

发布于 2024-08-07 10:08:35 字数 326 浏览 3 评论 0原文

我们有基于 CAB(复合应用程序块)的智能客户端 winform 应用程序。

我们的软件要求之一是当用户更改应用程序中提供的语言选项时动态替换文本。

我们支持大约 6 种语言,包括东亚语言(中文/日语)、欧洲语言(俄语、西班牙语、英语、荷兰语)。

在深入了解本地化之后,我发现本地化不仅仅是动态替换文本。

我发现Windows控件是基于本地化资源选项创建的。 IT 具有格式化、验证之类的功能。

是否建议在不关闭表单/视图的情况下动态本​​地化文本? 或者应该重新启动应用程序? 或者关闭表单并重新打开表单

为什么不应该鼓励动态语言更改?

We have CAB (Composite Application Block) based smart client winform application.

One of our software requirement is to replacing the text dynamically when the user change the language option provided in our application.

We support around 6 languages including east-asian(Chinese/Japanese), European Languages(Russion, spanish, English, dutch).

After understanding some deep level into localization, I got to know that localization is more than just replacing the text dynamically.

I found that Windows controls are created based on localized resource option. IT has formatting, validation sort of feature.

Is it recommended to localize the text dynamically without closing the forms/views?
Or Should be restart the application?
Or close the form and reopen the form

Why should not encourage dynamic language change?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

-残月青衣踏尘吟 2024-08-14 10:08:35

我只会在启动时检查语言并加载适当的资源 (.resx) 文件来加载应用程序的所有字符串。您可以通过自己的方式执行此操作,或者我相信 .Net 有一种内置方法可以使用资源文件执行此操作。

您不想浪费 CPU 来监视动态语言更改。用户多久更改一次 PC 上的语言设置?如果他们即时切换语言,他们可以同样轻松地重新启动您的应用程序。

我知道当我把电脑从盒子里拿出来时,我只会将它们设置为英语,并且我希望任何国家的人们都会这样做——选择他们的母语。

I would only check the language on startup and load an appropriate resource (.resx) file to load all of the strings for your application. You can do this by your own means, or I believe .Net has a built in way to do this with resource files.

You do not want to waste CPU watching for dynamic language changing. How often would a user change their language settings on a PC? If they are switching languages on the fly, they can restart your application just as easily.

I know I only set my PC's to English when I pull them out of the box, and I would expect people of any country to do the same--pick their native speaking language.

我只土不豪 2024-08-14 10:08:35

不幸的是,没有一个好的解决方案可以动态更改区域设置。

Guy Smith-Ferrier 写了一本关于 .NET 国际化(字面意思)的书,以下是他的解决方案的代码: http ://www.dotneti18n.com/Downloads.aspx
根据我的经验,它并不适用于所有控件,基本上使其毫无用处。

只需在首次启动时将语言设置为 Windows 区域设置并将其保存在设置中,这对于大多数用户来说都是正确的。如果用户随后想要从应用程序内更改它,则只需要重新启动一个应用程序即可。

There is no good solution for changing the locale dynamically unfortunately.

Guy Smith-Ferrier wrote the book on .NET internationalization (literally), and here is the code for his solution: http://www.dotneti18n.com/Downloads.aspx
In my experience it doesn't work on all controls, basically making it useless.

Just set the languange to the Windows locale at first startup and save it in a setting, this will be correct for most users. If the user then want to change it from within the app, it will only require one application restart.

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