不仅通过文化自定义资源文件 [英] Customize Resources files not only by culture

查看:51
本文介绍了不仅通过文化自定义资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义我的资源文件,这是因为我们想为2个不同的公司使用相同的应用程序,这些应该是英语和西班牙语,现在我们有resorcs文件,如:

 

Resource.es-MX.resx

Resource.en-US.resx



但是我们希望得到类似的结果:



Resource.es-MX.resx

Resource.es-MX.Company1.resx

Resource.es-MX.Company2.resx

Resource.en-US.resx

Resource.en-US.Company1.resx

Resource.en-US.Company2.resx



我不知道这是否可行,如果这是你知道我怎么能这样做吗?我想我需要覆盖一些课程,但我不知道 哪个类,如果是可行的。这是因为我们想要这样做:



试图找到公司资源上的密钥(如果不存在)搜索文化的资源文件,例如我们想要'key1'的值 应用程序需要在Resource.en-US.Company2.resx上搜索,如果不存在,我们需要在Resource.en-US.resx上搜索,
如果你知道我是怎么做的,请告诉我。 />

解决方案

喜josh13jj,


也许你可以加载RESX文件以编程方式,请参阅:


https://docs.microsoft.com/en-us/dotnet/framework/resources/working-with-resx-files-programmatically



祝你好运,


张龙


Hi, I wanna customize my resources files, this is because we want to use the same app for 2 different company and these need to be in english and spanish, now we have the resorcs files like:
 
Resource.es-MX.resx
Resource.en-US.resx

but we want to implmente something like:

Resource.es-MX.resx
Resource.es-MX.Company1.resx
Resource.es-MX.Company2.resx
Resource.en-US.resx
Resource.en-US.Company1.resx
Resource.en-US.Company2.resx

And I don't know if this is possible, if this is posible you know how I can do it? I think I need to override some class but I don't know  which class and if is posible. this is because we want made this:

try to found the key on the company resource if not exists search on the resource file of the culture, for example if we wanted the value for 'key1'  the app need to search on Resource.en-US.Company2.resx if not exists we need to search on Resource.en-US.resx, please let me know if you know how I can made this.

解决方案

Hi josh13jj,

Maybe you could load resx files programmatically, for more information, please refer to:

https://docs.microsoft.com/en-us/dotnet/framework/resources/working-with-resx-files-programmatically

Best regards,

Zhanglong


这篇关于不仅通过文化自定义资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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