多语种WPF应用程序语种、应用程序、WPF

2023-09-04 22:52:01 作者:野生纯种萝莉绿色无污染

我有一个WPF应用程序(英文),我想,让用户选择不同的语言。我看过一些可能改变在运行的应用程序的语言,但我只希望选择在安装时语言,永远不会改变它。

I have a WPF application (in English) and I would like to let users to select different languages. I have read some possibilities to change languages in runtime applications, but I only want to choose a language during installation time and never change it.

你觉得这样做是开发不同版本的程序(只改变文本的语言),并让用户选择他们的安装过程中的一个最快,最简单的方法?大概重复code只改变文本框或标签,是不是很优雅,但是请注意,我用英文完成的应用程序,我不需要改变的语言在运行时。

Do you think the fastest and easiest way to do it is developing different versions of the program (changing only text language) and let the user to select one of them during the installation?? Probably to repeat code only changing textbox or labels is not very elegant, but notice that I have the application finished in English and I don´t need to change language at runtime.

谢谢!

推荐答案

我想提出Aghilas解决好;但你可以在步骤3中使用 DynamicResource 的StaticResource 而不是使用 DynamicResource 不需要你的情况,你是不会同时应用程序运行于chnage的语言。

I think the solution proposed by Aghilas is good; but you can use StaticResource instead of using DynamicResource in step 3, DynamicResource is not required in your case as you are not going to chnage the language while application is running.

另外看看这些文章有关于在WPF使用的Resx文件进行本地化的详细信息 -

Also have a look at these articles having details about using Resx files for localization in WPF -

本地化WPF应用程序使用的ResX文件

WPF本地化

WPF本地化指导 - 白皮书