ASP.NET本地化翻译HTML内容 [英] ASP.NET localization translating HTML Content

查看:145
本文介绍了ASP.NET本地化翻译HTML内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的自动功能,它会创建一个本地资源文件,并添加元关键字asp.net控件本地化的ASP.NET站点。不过,我有很多的HTML像下面

I am localizing an ASP.NET site using automatic feature , where it creates a local resource file and adds the meta keyword 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

感谢

推荐答案

您需要使用的本地化控制静态文本 - 例如,

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>

另外,

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

您也可以使用语法,如

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

其中, Resources.WebResources 是由Visual Studio资源发生器产生的强类型的资源类。跨页面资源,您可以创建全球资源,然后引用然后使用语法如上图所示(meta键将不会对全球资源的工作)。

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).

请参阅 MSDN 了解详情。

这篇关于ASP.NET本地化翻译HTML内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆