9

我有这样的文本要本地化

<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"))

(这不起作用,因为链接变成了字符串)
还是我必须将段落分成两部分?

4

1 回答 1

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>
于 2012-04-11T08:43:20.037 回答