views:

42

answers:

2

Having the following markup

<p> 
    No items found. Want to
    <asp:LinkButton ID="LinkButton1" runat="server" OnCommand="LinkButton1_Command" Text="create" />
    a new one?
</p>

how do i localize both the text and LinkButton.Text? I don't want to create two literals that frame the link. Is there a better way?

+1  A: 

In this particular case you pretty much have to. However, your grammar is more complex than it needs to be - you would probably never insert a different word before "a new one" - e.g. "Want to [delete] a new one?" doesn't make sense. So I'd recommend putting "a new one" as part of the link text, so you only need one literal for the "No items found".

Rex M
The order of words could be different in other languages, which could still require the "donut" scenario.
Greg
@Greg that is highly unlikely. The "create" sentence and the "no items found" sentence represent two distinct thoughts.
Rex M
Good point. Sounds good to me.
Greg
Sorry, i'm not native and simplified the sample a bit. I wonder what was ASP.NET team thoughts on this (i'm sure they met the case).
UserControl
+1  A: 

If you could get away with a straight HTML solution instead of the asp:LinkButton, you could embed the entire thing into one resource string.

No items found. Want to a <href="javascript:__doPostBack('Link1','')">create</a> a new one?

You'd then have to manually check the Request["__EVENTTARGET"] instead of using the wired up event handler.

I'm not saying it's a good idea, but I guess it could work.

Greg
Looks like the best solution possible, thanks!
UserControl