[plug] Save a soul from scripting insanity...
Russell Keith-Magee
Russell.Magee at calytrix.com
Tue Aug 13 11:38:11 WST 2002
Ok - I'm about to go mad (more so than normal).
I have a large number of Java source files, which contain a large number of
function calls to a translation engine:
Translator.translate("Foobar");
Sometimes the call is a parameter itself:
dostuff(Translator.translate("Foobar"),1,2,3);
Sometimes the string parameter is split over lines:
Translator.translate("foobar is just the start" +
" of a very long string);
There can be multiple instances of a translation call on a single line of
code:
Translator.translate("Foo"), Translator.translate("Bar"),
The string may contain semicolons, brackets, and escaped quotation marks:
Translator.translate("foo: (Bar or \"whiz\")");
The translator can also take parameters under some circumstances:
Translator.translate("Foobar", 3);
What I need to do: write a script, or set of scripts, of any sort (shell,
perl, sed, awk, whatever) that will:
1) Search through every source file in a given directory tree
2) Find all the calls to Translator.translate
2) Extract the text to be translated. If the text is split over lines, put
the full string on a single line. If there are other arguments to
Translator.translate, discard them.
This will leave me with one big file, containing one translation string per
line. I can then sort and uniq this file to get a list of strings that need
to be translated.
It also needs to be completely automated - no human input allowed.
I've found lots of partial solutions; however, none of them seem to do the
complete job - I have a basic working knowledge of most of these tools to
get partial solutions, but nowhere near the 1337 5k1llz I need to do the
complete job.
Is there a plugger out there who is able to stop me from from turning
homicidal?
Many thanks in advance
Russ %-)
********************************************
Dr Russell Keith-Magee
Software Engineer
Calytrix Technologies
Unit 9, EIR Building, Technology Park
PO Box 1173, BENTLEY 6982, Western Australia
More information about the plug
mailing list