I'm currently localising a ASP.NET Core Razor Pages application. I use the "old" way of localising, with a compiled ResX file, and in my cshtml I use
<h3>@Global.Access</h3>
"Global" being the resource file, "Access" being the key to the resource string.
I prefer to use this approach over an injected localizer:
@localiser["Access"]
Because this allows me to identify missing strings in the resource file during compile time.
Now, I have a resource string with a placeholder:
StringWithPlaceholder: "You can visit {0} for more information"
When I use following code in the cshtml everything works:
@{
var linkvariable = "<a href=\"url-to-my-page\">blabla</a>";
}
@string.Format(Global.StringWithPlaceHolder, linkvariable);
But if I replace the href by the asp-page tag helper, the tag helper is not rendered.
@{
linkvariable = "<a asp-page=\"my-page\">blabla</a>";
}
How could I resolve this?