summaryrefslogtreecommitdiffstats
path: root/pot/preparetips
blob: 1e5c35aeebfe99747207f1f16c3105522cb0cfd3 (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
# !/usr/bin/perl
# 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 <matthias.kiefer@gmx.de>
# Command line option added by Joachim Ansorg

open(FILE,"<$ARGV[0]") || die "unable to open tips file";

$inTip=0;

while(<FILE>)
{
	chomp;

	# tip starts with <html>
	if(/^\s*<html>/i)
	{
		$inTip=1;
		print "\ni18n(\n";
		next;
	}	

	if($inTip!=0)
	{
		# tip ends with </html>
		if(/^\s*<\/html>/i)
		{
			print ");\n";
			$inTip=0;
		}
		else
		{
			# replace \ with \\
			s/\\/\\\\/g;

			# replace " with \"
			s/"/\\"/g;
			
			print "\"$_\\n\"\n";
		}
	}   
}

close(FILE);