通过插件方式实现c#应用程序多语言UI(动态绑定)? [英] Implement c# application multilingual UI by plug-in way(dynamic binding)?

查看:62
本文介绍了通过插件方式实现c#应用程序多语言UI(动态绑定)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,


有一篇文章告诉我们如何设置  c#应用程序的多语言UI,请参阅下面的链接,


https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/y99d1cd3(v = vs.90)


这种方式是静态绑定。


如果还支持一种语言,我们需要这样做


1。在资源文件中添加语言。


2。编译代码。


3。发布代码。


有没有更好的方法,比如插件方式让我们下载新语言的dll库来节省重新编码的时间?


谢谢和问候,


E-John

解决方案

< blockquote>

您可以简单地为新语言创建.resx文件,并将其自身编译为.dll。然后,只需将DLL复制到程序文件夹,它将被自动识别。您不必更改程序代码中的任何内容以使其正常工作,如果您的程序已经知道如何从其现有资源中获取翻译,则需要


您可以通过启用Fusion Log(使用FUSLOGVW.EXE)并查看程序尝试加载的DLL来验证这一点。您将看到它如何尝试加载包含当前语言环境的名称的DLL,当它失败时,它将恢复为
默认资源。通过将具有正确名称的DLL复制到要读取的文件夹,它将使用内部资源。


Dear All,

There is an article to teach us how to setup a  multilingual UI for c# application, see link below,

https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/y99d1cd3(v=vs.90)

This way is static binding.

If there is one more language be supported, here are what we need to to

1. Add a language in resource file.

2. Compile the code.

3. Release the code.

Is there a better way, like plug-in way for us to download the dll library of new language to save the time of re-coding?

Thanks and regards,

E-John

解决方案

You can simply create a .resx file for the new language and compile it into a .dll by itself. Then, just copy the DLL to the program folder and it will be recognized automatically. You don't have to change anything in the program code to make this work, if your program already knows how to pick up the translations from its existing resources.

You can verify this by enabling the Fusion Log (use FUSLOGVW.EXE), and looking at the DLLs that the program is trying to load. You will see how it tries to load a DLL with a name that contains the current locale, and when it fails it then reverts to the default resource. By copying a DLL with the correct name to the folder where it's tying to be read, it will use the resources inside.


这篇关于通过插件方式实现c#应用程序多语言UI(动态绑定)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆