我如何搜索静态文本的情况下,在ASP.NET页面和控件的标记? [英] How can I search for instances of static text in the markup of ASP.NET pages and controls?

查看:162
本文介绍了我如何搜索静态文本的情况下,在ASP.NET页面和控件的标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个国际化的Web应用程序中,所有的文本的,最终被发送到浏览器是由code-背后,无论是由该用户控件覆盖渲染,或code,设置了文本 标签等控制

I've got an internationalised web application in which all the text that eventually gets sent to the browser is generated by code-behind, either by usercontrols that override Render, or by code that sets the Text of Label etc controls.

例如,而不是一个 ASPX 包含

<h2>Subtitle</h2>
<p>Some paragraph</p>

这个应用程序将代替

<h2><asp:Label runat="server" ID="SubTitle" /></h2>
<p><mycontrols:Literal runat="server" ID="Paragraph" /></p>

与实际文本只能在运行时得到供应。

with the actual text only getting supplied at runtime.

我想确保我没有无意中留在标记任何静态文本的任何地方。不过,我能想到的所有方法都有缺陷:

I would like to ensure that I haven't inadvertently left any static text in the markup anywhere. However, the ways I can think of all have flaws:


  • 我不能使用一个工具,试图解析标记为XML,因为 *为?X 标记绝对不是有效的XML

  • 我甚至不能使用HTML解析器(如HtmlAgilityPack),因为 *为?X 标记(记住,这是之前它是由ASP.NET渲染)也未必是有效的HTML(考虑中继模板如何交错标签)

  • 只需使用Visual Studio查找不会帮我找到刚才静态文本,而不是,比方说,CSS类名

  • I can't use a tool that tries to parse the markup as xml, because *.as?x markup definitely isn't valid xml
  • I can't even use an html parser (such as HtmlAgilityPack), because *.as?x markup (remembering this is before it's rendered by ASP.NET) also isn't necessarily valid html (consider how repeater templates can interleave tags)
  • Just using Visual Studio Find won't help me find just static text and not, say, CSS class names

难道还有比通过每个页面?

Is there any way other than manually checking through every page?

推荐答案

好了,如果它是一个网站支持国际化 - 点它的许多免费网站下载器应用程序之一 - 和输出拉到磁盘上。在法语中运行它(或您选择的语言),当时的德国。任何哈日codeD文本字符串不会改变。那么你就必须找到一个工具的WinMerge(我认为的WinMerge可以做的文件夹),或者写一些东西,可以比较文件的输出。然后PowerGrep定位结果回源。

Ok, so if it's a a site supporting internationalisation - point one of the many free web site downloaders apps at it - and pull the output onto disk. Run it in French (or language of your choice) then German. Any harcoded text strings will not change. You'll then have to find a WinMerge tool (I think WinMerge can do folders) or write something that can file compare the output. Then PowerGrep to locate the results back in your source.

这篇关于我如何搜索静态文本的情况下,在ASP.NET页面和控件的标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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