Localization in WPF

Localization in WPF

韬韬不绝 发布于 2021-11-29 字数 292 浏览 688 回复 3 原文

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!

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

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

评论(3

眼睛会笑 2022-06-07 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

初心 2022-06-07 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

眼角的笑意。 2022-06-07 1 楼

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