TranslatorShellscript
Disclaimer: This scripts are far away from "flawless". Anyhow, try it, like it, use it; dislike it, improve it :).
And, yes, I know, its programming is pathetic :). And, yes, more knowledge about WML would definitely improve it. Or a higher frustration threshold... :). Or the accuracy, a real programmer would have (and test it with more than one po-file in one language only). Hence, improvements might be a very good idea - but does anybody need it?
Feel free to post improvements. Or in which languages it does not work at all. What kind of shell script would be nice as well?
Or even realize them on a higher level - why not writing a script to transform it in TEX - per aspera ad astra :).
Contents
Extracting a target language script
For proof-reading of a campaign it might be much easier to print it out in a more "scriptlike" format (<charactername>: <text>) (target language only), e.g. to read it in a bus.
- >cat ./de.po | grep -v "msgid \"" | grep -v "#: data" | sed "s/\[message\]: speaker//g" | sed "s/#. =//g" | sed "s/msgstr/:/g" |grep -v ": \"\"" | sed ':;s/\n:/:/;N;T' | sed ':;s/\n\n/\n/;N;T'| sed "s/#. \[scenario\]/\n#. \[scenario\]/g" > target-language-script.txt
Extracting an English script
For proof-reading of a campaign it might be much easier to print it out in a more "scriptlike" format (<charactername>: <text>) (english only), e.g. to read it in a bus. This one is even more preliminary than the one before. It still contains some target language parts.
- >cat de.po | grep -v "msgstr \"" | grep -v "#: data" | sed "s/\[message\]: speaker//g" | sed "s/#. =//g" | sed "s/msgid/:/g" |grep -v ": \"\"" | sed ':;s/\n:/:/;N;T' | sed ':;s/\n\n/\n/;N;T'| sed "s/#. \[scenario\]/\n#. \[scenario\]/g" > english.txt
Extracting a list of charcters
using the command line
Be aware, that you should be in the right directory. It contains *.cfg files for each campaign-scenaio.
- > cd <wesnoth-installpath>/data/campaigns/Northern_Rebirth/scenarios
- >cat *.cfg | grep "description=" | grep -v "_" | sed 's/^[ \t]*//;s/[ \t]*$//' | sort |uniq -c | sort -nr > ~/NRcharacterlist.txt
using a shell script
save the following as script, e.g. extChar. Use it within the correct diretory (see above) with the target file as option. Use "chmod" to make it executable.
- #bash
- # extract characters/personnames from wesnoth cfg files
- cat *.cfg | grep "description=" | grep -v "_" | sed 's/^[ \t]*//;s/[ \t]*$//' | sort |uniq -c | sort -nr > ~/Desktop/$1
step 2 - if you want to have the characters list only
- >cat NRcharacterlist.txt | cut -d '=' -f 2