#!/usr/bin/perl use CGI; require "plans_config.pl"; require "plans_lib.pl"; #if ($ARGV[0] eq "" || $ARGV[1] eq "") $file0 = $language_file; $file1 = "us_english.pl"; # init cgi stuff $q = new CGI; $script_url = $q->url(-path_info>=1); $script_url =~ /(.*)\//; # remove trailing / and all text after $script_url = $1; # remove trailing / and all text after $theme_url = "$script_url/theme"; $css_path = "$theme_url/plans.css"; # css file open (FH, "$file0") or die "Error! unable to read from $file0!"; flock FH,2; @lines=; close FH; my %f0_vars = %{&extract_variables(\@lines)}; open (FH, "$file1") or die "Error! unable to read from $file1!"; flock FH,2; @lines=; close FH; my %f1_vars = %{&extract_variables(\@lines)}; my $results1=""; my $results2=""; foreach $var (keys %f0_vars) { if ($f1_vars{$var} != 1) { $results1 .= "$var found in $file0 but not $file1\n"; } } foreach $var (keys %f1_vars) { if ($f0_vars{$var} != 1) { $results2 .= "$var found in $file1 but not $file0\n"; } } if ($ENV{HTTP_USER_AGENT} eq "") { print "$results1\n$results2"; } else { $results1 =~ s/\n/\n/g; $results2 =~ s/\n/\n/g; $results1 =~ s/(\$lang{.+})/$1<\/span>/g; $results2 =~ s/(\$lang{.+})/$1<\/span>/g; print < Plans language compare

This utility compares the language file defined in plans_config.pl with us_english.pl. It reports which variables are different between the two. Make sure you have the latest us_english.pl in the plans directory before running this.

$results1
$results2
p1 } exit(0); sub extract_variables() { my ($lines_ref) = @_; my @lines = @{$lines_ref}; my %vars=(); foreach $line (@lines) { if ($line =~ /\$lang{\S+}/) { my $var = $&; $vars{$var} = 1; } } return \%vars; }