我有像这样的本地化文本
<p>Please enter your user name and password. @Html.ActionLink(@Resources.Register, "Register") if you don't have an account. </p>
文本中经常有一个ActionLink。
我可以在整个ActionLink中使用类似{0}的东西
@string.Format(Resources.LogOn_Enter_Message, Html.ActionLink(@Resources.Register, "Register"))
(这不起作用,因为链接变成了一个字符串)
或者我是否必须将该段分为两部分?
答案 0 :(得分:9)
你应该这样做:
@Html.Raw(string.Format(Resources.LogOn_Enter_Message, Html.ActionLink(@Resources.Register, "Register")))
并存储您的本地化字符串:
<p>Please enter your user name and password. {0} if you don't have an account. </p>