Localization in WPF

泪湿孤枕 提交于 2019-11-27 11:08:46

问题


I am starting a new application in WPF and I am curious how to handle Localization? In WinForms you can use resx strings for the UI text, how is this done in WPF? Is there a special binding syntax for binding to resx resources or is there a different way of doing this?

Thanks!


回答1:


Check out WPF Globalization and Localization Overview. The article explains nicely how localization in WPF works.




回答2:


you can use a MarkupExtension to do localization with dynamic language switching. Here is an interesting article about this:

http://www.wpftutorial.net/LocalizeMarkupExtension.html




回答3:


I found very easy to start WPF localization with VS template, described in authors blog.

Project created using this template already contains all the necessary tools for localization, as well as the maximum automates the localization process. During application development, you add a new XAML file without having to worry about localization. Upon completion of the changes simply build project and change default language to translated.

Download template



来源:https://stackoverflow.com/questions/795025/localization-in-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!