summaryrefslogtreecommitdiffstats
path: root/amor/preparetips
blob: 03bcf67837bf2a891ac2050ff2c1c5759c7e00fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# little script to extract the text from the tips file
# and output it, so xgettext can add the tips to the po file
#
# 2000 by Matthias Kiefer <[email protected]>

open(FILE,"<data/tips-en") || die "unable to open tips file";

$inTip=0;
$tip="";

while(<FILE>)
{
	chomp;

	# tip ends with %
	if(!/^%/)
	{	
		# replace \ with \\
		s/\\/\\\\/g;

		# replace " with \"
		s/"/\\"/g;
	
		if($inTip != 0)
		{
			$tip=$tip."\n\"$_\\n\"";
		}
		else
		{
			$inTip=1;
			$tip="\"$_\\n\"";
		}

		next;
	}	
	elsif($inTip != 0)
	{
		# remove last newline
		$tip =~ s/\\n\"$/\"/g;
		print "i18n(\n", $tip, "\n);\n";
		$inTip=0;
	}
}

close(FILE);