Counting words in a txt file within quotation marks
Samuel Murray Netherlands Local time: 04:22 Member (2006) English to Afrikaans + ...
The grumpy old MS Word user method
Feb 9
Nurzhan Nagashbekov wrote:
#command some text "text to be localized" // comment
I'll assume for now that there are no multi-line segments (though that is not an impossible problem).
1. Open the file in a text editor, and copy/paste it into MS Word, and save it as a Word file.
2. Figure out how quotation marks within the quoted text is escaped (e.g. it is doubled up like ""this"" or it may be escaped with a slash like \"this\"). Replace those with something unique eg. "@@@".
3. Select all text in MS Word and highlight it (e.g. yellow).
4. Global replace ^l with ^p.
5. Global replace ^p (highlighted) with ^p (not highlighted) (ask if you don't know how to do that).
This means that every segment is highlighted but is delimited by some text that is not highlighted (i.e. the paragraph mark). This is so that you can restrict MS Word's regex find/replace to within the segments -- if you tell MS Word to process only highlighted text, it will not do the regex matching across multiple segments because segments are delimited by non-highlighted text.
6. Do this find/replace with wild cards:
Find: \"*\"
Replace: (nothing) (formatted as "Not highlighted").
Now all translatable text is not highlighted. Delete all highlighted text, and count what's left.
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.
Start and finish your translations faster than ever with Fluency Translation Suite 2011. TMs, Terminology, and Online Resources are all fully integrated and only a click away. Download a free trial today!