Warning, /games/amor/preparetips is written in an unsupported language. File is not indexed.
0001 #!/usr/bin/env perl
0002 # little script to extract the text from the tips file
0003 # and output it, so xgettext can add the tips to the po file
0004 #
0005 # 2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
0006
0007 open(FILE,"<data/tips-en") || die "unable to open tips file";
0008
0009 $inTip=0;
0010 $tip="";
0011 $tipline=1;
0012
0013 while(<FILE>)
0014 {
0015 chomp;
0016
0017 # tip ends with %
0018 if(!/^%/)
0019 {
0020 # replace \ with \\
0021 s/\\/\\\\/g;
0022
0023 # replace " with \"
0024 s/"/\\"/g;
0025
0026 if($inTip != 0)
0027 {
0028 $tip=$tip."\n\"$_\\n\"";
0029 }
0030 else
0031 {
0032 $inTip=1;
0033 $tip="\"$_\\n\"";
0034 $tipline=$.;
0035 }
0036
0037 next;
0038 }
0039 elsif($inTip != 0)
0040 {
0041 # remove last newline
0042 $tip =~ s/\\n\"$/\"/g;
0043 print "// i18n: file: data/tips-en:", $tipline, "\n// i18n: ectx: \@info:tipoftheday\n";
0044 print "i18n(", $tip, ");\n";
0045 $inTip=0;
0046 }
0047 }
0048
0049 close(FILE);