简体   繁体   中英

Localization not working for all the Markup / Tags in ASPX page

While localizing the Content for an ASPX page through Visual studio and selecting the Option: "Generate Local Resources " the text is not getting localized for all HTMLs. FOr example, There are <p> tags and other server control tags like Label.

<p>Carrying out Localization on my First Website </p>
<asp:Label runat="server" ID="label1"></asp:label>

After selecting the Option: "Generate Local Resources " from "Tools" menu, below is what seen in markup:

<p>Carrying out Localization on my First Website </p>
<asp:Label runat="server" ID="label1" meta:resourcekey="labelResource1"></asp:label>

How can I localize the content placed inside <p> tags or any <h1> , <h2> tags ?

This link provides an answer to your question on how to localize content placed inside html tags. You can store it in resource file and use it in html mark up as <%=Resources.WebResources.YourText%> as described there by VinayC where Resources.WebResources is strongly typed resource class generated by Visual Studio resource generator.Please let me know if this answers your question.

The control that needs to be localized will have to run serverside.

You could place a <asp:Label/> or <asp:Panel/> inside the HTML <p> . A label will render to a <span/> , and a panel will render to a <div/> .

It is also possible to run the p at serverside : <p runat="server" id="p1"></p> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM