HinzugefĆ¼gt:
[ipfire-2.x.git] / tools / check_strings.pl
CommitLineData
cd1a2927
MT
1#!/usr/bin/perl\r
2#\r
3############################################################################\r
4# #\r
5# This file is part of the IPCop Firewall. #\r
6# #\r
7# IPCop is free software; you can redistribute it and/or modify #\r
8# it under the terms of the GNU General Public License as published by #\r
9# the Free Software Foundation; either version 2 of the License, or #\r
10# (at your option) any later version. #\r
11# #\r
12# IPCop is distributed in the hope that it will be useful, #\r
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #\r
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #\r
15# GNU General Public License for more details. #\r
16# #\r
17# You should have received a copy of the GNU General Public License #\r
18# along with IPCop; if not, write to the Free Software #\r
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #\r
20# #\r
21# Copyright (C) 2004-03-12 Mark Wormgoor <mark@wormgoor.com> #\r
22# #\r
23############################################################################\r
24#\r
25# $Id: check_strings.pl,v 1.1.2.4 2005/02/28 19:35:03 eoberlander Exp $\r
26#\r
27\r
28my (%tr2, $basedir);\r
29\r
30use Cwd;\r
31use File::Find;\r
32\r
33$basedir = cwd();\r
34require "${basedir}/langs/en/cgi-bin/en.pl";\r
35\r
36sub wanted {\r
37 if ( -f $File::Find::name && open(FILE, $File::Find::name)) {\r
38 while (<FILE>) {\r
39 while ($_ =~ /\$Lang::tr{'([A-Za-z0-9,:_\s\/\.-]+)'}/g) {\r
40 $tr2{$1} = 'empty string';\r
41 }\r
42 }\r
43 close(FILE);\r
44 }\r
45}\r
46\r
47## Main\r
48find (\&wanted, $basedir );\r
49\r
50for my $key ( sort (keys %tr) ) {\r
51 my $value = $tr{$key};\r
52 if (! $tr2{$key}) {\r
53 print "WARNING: translation string unused: $key\n";\r
54 }\r
55}\r
56\r
57for my $key ( sort(keys %tr2) ) {\r
58 my $value = $tr2{$key};\r
59 if (! $tr{$key}) {\r
60 print "WARNING: untranslated string: $key\n";\r
61 }\r
62}\r