在.Net中访问资源文件 [英] Accessing Resource file in .Net

查看:65
本文介绍了在.Net中访问资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个斯瓦希里语资源文件到一个表格,该语言正在从英语转换为斯瓦希里语.但是当我部署并安装该应用程序时,它并没有从英语转换为斯瓦希里语.请告诉我答案

I created a kiswahili language resource file to a form, the language is converting from english to kiswahili. But when i deploy the application and install it, it is not converting from english to swahili. Please tell me the answer

推荐答案

您不需要访问资源文件. .NET框架已经使用卫星程序集的机制为您完成了此操作.您只需要指定所需的线程区域性和线程UI区域性即可;并使用 fallback 机制自动选择卫星组件.

阅读有关创建和使用卫星组件的信息: http://msdn.microsoft.com/en-us/library/21a15yht%28v=VS.100%29.aspx [
You do not need to access resource files. It is already done for you by .NET framework using the mechanism of satellite assemblies. You only need to specify required thread culture and thread UI culture; and the satellite assembly is selected automatically, with the fallback mechanism.

Read on creation and using of satellite assemblies: http://msdn.microsoft.com/en-us/library/21a15yht%28v=VS.100%29.aspx[^] and around this MSDN article.


Answering a follow-up question:

How to assign a culture? Something like this:

System.Globalization.CultureInfo myCulture =
   new System.Globalization.CultureInfo("es-ES", false); //the string can come from config. file and the like

//...

System.Threading.Thread myThread = System.Threading.Thread.CurrentThread;
myThread.CurrentCulture = myCulture;
myThread.CurrentUICulture = myCulture;



参见:
http://msdn.microsoft.com/en-us/library/system.globalization. cultureinfo.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/bkb1k2x8.aspx [ ^ ].

您需要阅读有关项目全球化以及针对每种文化的本地化的完整技术链.从技术上讲,当您知道所涉及的内容时,它就很容易.

http://msdn.microsoft.com/en-us/library/ms752337.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/aa292205%28v = vs.71%29.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/ms788718.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/c6zyy3s9.aspx [ ^ ].

—SA



See:
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx[^],
http://msdn.microsoft.com/en-us/library/bkb1k2x8.aspx[^].

You need to read about full chain of techniques for globalization of the project and following localizations for each culture. Technically, it''s easy enough when you know what''s involved.

http://msdn.microsoft.com/en-us/library/ms752337.aspx[^],
http://msdn.microsoft.com/en-us/library/aa292205%28v=vs.71%29.aspx[^],
http://msdn.microsoft.com/en-us/library/ms788718.aspx[^],
http://msdn.microsoft.com/en-us/library/c6zyy3s9.aspx[^].

—SA


这篇关于在.Net中访问资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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