gpt4 book ai didi

c# - 如何本地化包含 Html.ActionLink 的文本

转载 作者:太空狗 更新时间:2023-10-29 17:49:45 26 4
gpt4 key购买 nike

我有这样的文本需要本地化

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

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

最佳答案

你应该这样做:

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

关于c# - 如何本地化包含 Html.ActionLink 的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10102487/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com