ASP.NET: explicit vs implicit localization?

ぃ、小莉子 提交于 2019-12-09 17:41:18

问题


To my mind the advantage of implicit localization over explicit localization is that if you have more than one property to localize for a given control, it's a more economical syntax.

In the case where you just need to localize some text I use the asp:Localize control which only has a single property (Text) that renders to the UI. Is there a reason to use one over the other? Any style preference? Are there any speed differences?

Implicit

<asp:Localize ID="Localize1" runat="server" meta:resourcekey="Something" />

vs

Explicit

<asp:Localize ID="Localize1" runat="server" Text="<%$ Resources:Something %>" />

回答1:


I'm more in favor over Explicit, sometimes you need to encode/decode what you have localized. Also, when dealing with multiple languages and culture, using Explicit saves you headaches..




回答2:


Well your question got me thinking if any of the two provides complie time error check. And found that it dose not provide compile time check. Both bombs at run time when given wrong values.



来源:https://stackoverflow.com/questions/3535797/asp-net-explicit-vs-implicit-localization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!