ASP.Net中的本地化类似于Spring [英] Localization in ASP.Net similar to Spring

查看:151
本文介绍了ASP.Net中的本地化类似于Spring的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我之前使用的是Spring.NET,但由于框架似乎已经过时,我正试图使用​​AutoFac或StructureMap继续前进。



除了使用Spring.NET for DI之外,我还使用了SessionCultureResolver等其他组件在Session中存储CultureInfo信息,并且我使用了自己的实现AbstractLocalizer。



我的问题是关于Spring.Net AbstractLocalizer提供的功能。在Spring.Net中,我可以使用.resx文件,我用Access Modifier无代码生成标记,我可以将资源字符串添加到名为f.ex的resx中。 $ this.literalHeader.Text。然后,Spring.Net将该条目的值注入控件'literalHeader'的'Text'属性到相应的aspx或ascx。 Spring.Net称之为推送本地化。

参考文档:第20章Spring.NET Web框架,请看20.6.1



有没有人在开源框架中看到过这个或类似的功能?我想删除对Spring.Net的mye引用,但我不想做一个使用meta-resourcekey修改所有aspx页面的繁琐工作。



任何有关解决这个问题的建议或意见都会非常感激。



我知道Spring.Net使用的方法并不是最好的表现,因为我怀疑这个数字很大需要反射来定位控件和属性以注入值,但这是我已经遇到的性能下降。与修改所有resx'es和页面,控件等所需的工作相比,这是可接受的成本。

Hi,

I've earlier used Spring.NET, but as the framework seems to be outdated, i'm trying to move onwards using AutoFac or StructureMap.

Besides using Spring.NET for DI, i've used other components such as SessionCultureResolver to store CultureInfo information in Session, and i've used my own implementation of an AbstractLocalizer.

My question is regarding the functionality the Spring.Net AbstractLocalizer offers. In Spring.Net, i can use .resx files, which i mark with Access Modifier "No code generation", and i can add resource strings to the resx named f.ex. '$this.literalHeader.Text'. Spring.Net will then inject the Value of that entry to the 'Text' Property of the control 'literalHeader' to the corresponding aspx or ascx. Spring.Net calls this 'Push localization'.
Reference docs: Chapter 20. Spring.NET Web Framework, look at 20.6.1

Has anyone seen this or similar functionality isolated in an open-source framework? I want to remove mye references to Spring.Net, but i don't want to do the tedious work of modifying all my aspx pages with a meta-resourcekey.

Any suggestions or input to solving this will be highly appreciacted.

I know the approach Spring.Net use is not the best for performance, as I suspect that a great amount of reflection is needed to locate controls and properties to inject values, but this is a performance degradation I'm already experiencing. It is an acceptable cost compared to the work needed to be done modifying all resx'es and pages,controls and so on.

推荐答案

this.literalHeader.Text'。然后,Spring.Net将该条目的值注入控件'literalHeader'的'Text'属性到相应的aspx或ascx。 Spring.Net称之为推送本地化。

参考文档:第20章Spring.NET Web框架,请看20.6.1



有没有人在开源框架中看到过这个或类似的功能?我想删除对Spring.Net的mye引用,但我不想做一个使用meta-resourcekey修改所有aspx页面的繁琐工作。



任何有关解决这个问题的建议或意见都会非常感激。



我知道Spring.Net使用的方法并不是最好的表现,因为我怀疑这个数字很大需要反射来定位控件和属性以注入值,但这是我已经遇到的性能下降。与修改所有resx'es和页面,控件等所需的工作相比,这是可接受的成本。
this.literalHeader.Text'. Spring.Net will then inject the Value of that entry to the 'Text' Property of the control 'literalHeader' to the corresponding aspx or ascx. Spring.Net calls this 'Push localization'.
Reference docs: Chapter 20. Spring.NET Web Framework, look at 20.6.1

Has anyone seen this or similar functionality isolated in an open-source framework? I want to remove mye references to Spring.Net, but i don't want to do the tedious work of modifying all my aspx pages with a meta-resourcekey.

Any suggestions or input to solving this will be highly appreciacted.

I know the approach Spring.Net use is not the best for performance, as I suspect that a great amount of reflection is needed to locate controls and properties to inject values, but this is a performance degradation I'm already experiencing. It is an acceptable cost compared to the work needed to be done modifying all resx'es and pages,controls and so on.


这篇关于ASP.Net中的本地化类似于Spring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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