Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can I use resourcekey in HTML?

I wrote an ASP.Net Program that use resource key to support multi language support

Now I want to tokenize this module to enable user give template to it.

for that I give tokens to user to drop it in module and I will replace it. for example if user type [lblsomething] in HTML I will replace it with

<span id="lblsomething"> something </span>

Now the problem is how can i use resource key with this span to support multi language just like what i have in ASP.Net <asp:label resourcekey="lblsomething"></asp:label>

Thanks a lot for any help you can provide

like image 619
Mosijava Avatar asked Feb 21 '23 15:02

Mosijava


2 Answers

You neeed to add runat="server" to the control.

<span id="something" runat="server" meta:resourcekey="PressMeButtonResources"/>

Or alternatively, you can use literal control inside the span tag.

like image 55
Sandy Avatar answered Mar 05 '23 03:03

Sandy


Strangely the solution Localization.GetString... by atabrizi doens't work for me.

This works in my case (example for birthday label + textbox in a form):

<label for="birthday">
  <%=GetLocalResourceObject("form_Birthday.Text").ToString()%>
</label>
<input type="text" id="birthday" name="birthday" />

msdn: How to: Retrieve Resource Values Programmatically

like image 31
firepol Avatar answered Mar 05 '23 02:03

firepol