在ASP.NET内联标签全球化的区别

编程入门 行业动态 更新时间:2024-10-26 06:27:00
本文介绍了在ASP.NET内联标签全球化的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有使用内联写标签,而不是资源的标签之间的任何优势/挫折?例如:

Is there any advantage/downfalls between using the inline write tag instead of the resource tag? Example:

<%=Resources.Site.SampleString %>

所看到的任何MSDN例子中的资源标记(如pression标签):

The resources tag (expression tag) as seen in any MSDN example:

<asp:Literal id="Literal1" runat="server" text="<%$ Resources:Site, SampleString %>" />

我找到的第一个选项更容易使用,它有智能感知,但也许它不会起作用一样?

I find the first option far easier to use, and it has IntelliSense, but maybe it won't function the same?

推荐答案

这些方法的功能完全相同。后者只是调用第一个;还有就是在后台生成强类型资源的访问code的理由。因此,你可以使用你取悦任何方法。

These methods will function exactly the same. The latter simply calls first one; there is a reason why strongly-typed resources access code is being generated in the background. Therefore you can use whatever method you please.

对了,还有另一种方式 - 通过的元:获取ResourceKey属性。所以,你应该能够写:

By the way, there is also another way - by using meta:resourcekey attribute. So you should be able to write:

<asp:Literal id="Literal1" runat="server" meta:resourcekey="SampleString" text="Default one" />

而这一切应该工作完全相同。

and it all should work exactly the same.

修改隐式本地化。

我忘了提,就是与元:获取ResourceKey一定的条件必须得到​​满足。的条件是:

What I forgot to mention, is that with meta:resourcekey certain conditions have to be met. The conditions are:

  • 值从App_LocalResources文件拍摄,因此相关的资源文件,有存在的必要
  • 相关资源文件名必须是pagename.resx,例如:为Default.aspx.resx,Default.aspx.es.resx
  • 的资源文件必须包含resourcekey.propertyname形式键,例如SampleString.Text,SampleString.ID(虽然我不会本地化控制的ID)
  • 由于是如何产生的资源
  • ,上面提到的密钥必须存在于不变的资源文件(为Default.aspx.resx),否则将不进行本地化。

更多推荐

在ASP.NET内联标签全球化的区别

本文发布于:2023-11-09 20:18:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573330.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:内联   区别   标签   ASP   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!