2012-04-11 39 views
9

我有文字本地化這樣如何本地化的文本與包括Html.ActionLink

<p>Please enter your user name and password. @Html.ActionLink(@Resources.Register, "Register") if you don't have an account. </p> 

很多時候有文本的ActionLink的。

我可以使用類似{0}整個ActionLink的

@string.Format(Resources.LogOn_Enter_Message, Html.ActionLink(@Resources.Register, "Register")) 

(這不起作用,因爲該鏈接就成了一個字符串)
還是我來劃分段落成2部分?

回答

8

你應該做的是這樣的:

@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> 
+0

Gaaah我是如此接近:-) THX。 – nubm 2012-04-11 08:46:40