+use strict;
+use warnings;
+use Getopt::Std;
+use Encode qw(encode decode);
+
+sub mylc($);
+sub replaceSynopsis($);
+
+my $usage = <<EOT;
+pocheck.pl [-acmpqst] po_file [po_file] ...
+
+This script performs some consistency checks on po files.
+
+We check for everything listed here, unless one or more of these
+options is given, in which case we checks only for those requested.
+-a: Check arguments, like %1\$s
+-c: Check for colons at end
+-m: Check for menu shortcuts
+-p: Check for period at end
+-q: Check Qt shortcuts
+-s: Check for space at end
+-t: Check for uniform translation
+These options can be given with or without other options.
+-f: Ignore fuzzy translations
+-w: Only report summary total of errors
+-i: Silent mode, report only errors
+EOT
+
+my %options;
+getopts(":hacfmpqstwi", \%options);
+
+if (defined($options{h})) {
+ print $usage;
+ exit 0;
+}
+
+my $only_total = defined($options{w});
+delete $options{w} if $only_total;
+my $ignore_fuzzy = defined($options{f});
+delete $options{f} if $ignore_fuzzy;
+my $silent_mode = defined($options{i});
+delete $options{i} if $silent_mode;
+
+my $check_args = (!%options or defined($options{a}));
+my $check_colons = (!%options or defined($options{c}));
+my $check_spaces = (!%options or defined($options{s}));
+my $check_periods = (!%options or defined($options{p}));
+my $check_qt = (!%options or defined($options{q}));
+my $check_menu = (!%options or defined($options{m}));
+my $check_trans = (!%options or defined($options{t}));
+
+my %trans;
+
+my $total_warn = 0;
+
+foreach my $pofilename ( @ARGV ) {
+ my %bad;
+ if (!$silent_mode) {
+ print "Processing po file '$pofilename'...\n";
+ }