問(wèn)題描述
在尋求本地化的過(guò)程中,我需要找到散落在我們?cè)创a中的所有字符串文字.我正在尋找一種將其編寫(xiě)到修改后源存儲(chǔ)庫(kù)檢查中的方法.(在某些人檢查某些內(nèi)容后,IE 有一個(gè)框設(shè)置來(lái)檢查此統(tǒng)計(jì)信息)我可能會(huì)使用 NAnt 和 CruiseControl 或其他東西來(lái)處理 CVS 的管理(在我的情況下是 StarTeam :()但是你知道任何可編寫(xiě)腳本的嗎(或命令行)實(shí)用程序來(lái)準(zhǔn)確循環(huán)通過(guò)源代碼查找字符串文字?我意識(shí)到我可以根據(jù)正則表達(dá)式進(jìn)行簡(jiǎn)單的字符串查找,但想要更多的收益.(也許分析字符串或?qū)⑵浞诸? 因?yàn)楹芏鄷r(shí)候字符串不一定需要翻譯.有什么想法嗎?
In the quest for localization I need to find all the string literals littered amongst our source code. I was looking for a way to script this into a post-modification source repository check. (I.E. after some one checks something in have a box setup to check this stat) I'll probably use NAnt and CruiseControl or something to handle the management of the CVS (Well StarTeam in my case :( ) But do you know of any scriptable (or command line) utility to accurately cycle through source code looking for string literals? I realize I could do simple string look up based on regular expressions but want a little more bang for my buck. (Maybe analyze the string or put it into categories) Because a lot of times the string may not necessarily require translation. Any ideas?
推薦答案
Visual Studio 2010 及更早版本:
Visual Studio 2010 and earlier:
- 在文件中查找 (CTRL+SHIFT+F)
- 使用:正則表達(dá)式
- 查找:
:q
(帶引號(hào)的字符串) - 查找全部
查找結(jié)果"窗口現(xiàn)在將包含所有文件的報(bào)告,包括行號(hào)和帶引號(hào)的字符串的行本身.
Find Results window will now contain a report of all files, with line numbers and the line itself with the quoted string.
對(duì)于 Visual Studio 2012 及更高版本,搜索 ((".+?")|('.+?'))
(參考,對(duì) @CincauHangus)
For Visual Studio 2012 and later search for ((".+?")|('.+?'))
(reference, hat-tip to @CincauHangus)
這篇關(guān)于搜索字符串文字的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!