Reputation: 1153
I have text to localize like this
<p>Please enter your user name and password. @Html.ActionLink(@Resources.Register, "Register") if you don't have an account. </p>
Very often there is an ActionLink in the text.
Can I use something like {0} for the whole ActionLink
@string.Format(Resources.LogOn_Enter_Message, Html.ActionLink(@Resources.Register, "Register"))
(this doesn't work because the link becomes a string)
or do I have to divide the paragraph into 2 parts?
Upvotes: 9
Views: 3829
Reputation: 12786
You should do it like this:
@Html.Raw(string.Format(Resources.LogOn_Enter_Message, Html.ActionLink(@Resources.Register, "Register")))
And store your localized string:
<p>Please enter your user name and password. {0} if you don't have an account. </p>
Upvotes: 9