开发者

ASP.NET localization translating HTML Content

I am localizing an ASP.NET site using automatic feature , where it creates a local resource file and adds the meta key开发者_如何学JAVAword to asp.net controls. However I have a lot of HTML like below

<h2> Welcome to our page"</h2>
<li> Option one </li>

Is there a way to get these automatically translated using the automatic localize utility ? I tried adding the runat="server" for these tags but to no avail.

Also instead of localizing page by page is there a way to localize bulk - it a directory or a site at one go

thanks


You need to use Localize control for static text - for example,

<h2>
   <asp:Localize runat=server ID="WelcomeMessage" 
    Text="Welcome to our page" meta:resourcekey="WelcomeMessage" />
</h2>

Alternatively,

<h2>
   <asp:Localize runat=server ID="WelcomeMessage" 
    Text="<%$ Resources:WebResources, WelcomeMessage %>" />
</h2>

You can also use syntax such as

<h2><%= Resources.WebResources.WelcomeMessage %></h2>

where Resources.WebResources is strongly typed resource class generated by Visual Studio resource generator. For across page resources, you can create global resources and then refer then using syntax as shown above (meta key will not work for global resources).

See MSDN for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜