Q:

Globalization and links in sentences

I am working on globalizing/localizing an asp.net application with C# as the backend.  We are in the process of extracting strings to a resource file, and have run into a problem.  We are trying to keep sentences together so that they are translatable, but this is not possible with links.  For Example:
<%= Strings.BeginningOfSentence %>
<asp:HyperLink id="exampleLink" runat="server"><%= Strings.MiddleOfSentence %></asp:HyperLink>
<%= Strings.EndOfSentence %>

Strings is the resource file.  If this were normal html for the link, I could use String.Format and keep the sentence together, adding in the html as two parameters, but that breaks it here.  Any ideas in how to make this work?

A:

You don't have to use a HyperLink control for this do you? If you need a dynamic link then you can store the anchor tag in a parameterised string and add the necessary attribute values using string.Format, like you suggested. Something like this:
Code:
myLiteral.Text = string.Format("{0} <a href=\"{1}\">{2}</a> {3}", Strings.BeginningOfSentence, myUrl, Strings.MiddleOfSentence, Strings.EndOfSentence);

ASPX:
<asp:Literal id="myLiteral" runat="server" />

