WPF locbaml-ed 应用程序和运行时语言切换?
我想知道是否有一个简单的解决方案可以在运行时更改 wpf 应用程序的语言。 我使用 locbaml 来全球化所有资源。 在应用程序构造函数中设置当前线程的 UICulture 工作正常,但是当我稍后尝试更改它时,我不再反映更改。 这实际上对于 winforms 来说很容易,但我不知道如何用 wpf 解决同样的问题。 有任何想法吗? 问候 j。
i wonder if there is a simple solution to change language of a wpf application during runtime. i used locbaml to globalize all the resources. Setting the Current Thread's UICulture in the App-constructor works fine, but when i try to chang it a little bit later, i doesn't reflect the changes anymore.
This was actually quite easy with winforms, but i have no clue how to solve the same problem with wpf.
any ideas?
regards
j.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不可以。
一旦加载程序集并将其绑定到您的应用程序,您就无法在工作中更改类。 您可以创建一个加载当前语言的引导程序集,当您更改语言时,您会自动关闭并重新打开应用程序,但我怀疑这就是您想要或需要的。
我在一个项目中所做的就是使用转换器等创建一个全球化的应用程序框架。您可以看到我遇到的一些问题 此处,特别是这篇文章显示了它的外观。 如果您决定像我一样走同样的路,那就太好了。
No.
Once you load an assembly and it is bound to your application, you can not change classes in mid-work. You could create a bootstrapper assembly that loads the current language and when you change the language you close and re-open your application automatically, but I doubt that's what you want or need.
What I did on one of my projects was create a globalized application framework using converters, etc. You can see some of the problems I ran into here and especially this post which shows how it looked. HTH if you decide to go the same way as I did.