summaryrefslogtreecommitdiffstats
path: root/perl-install/lang.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-04-05 10:00:11 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-04-05 10:00:11 +0000
commit6b7aa28fc8bc41747b86976cd5a235bb951c95dc (patch)
tree797bd8220ca96810ac771c47fc31686085d73592 /perl-install/lang.pm
parent6539fc1c00abafa5195e569fedbc24be5ef9b63d (diff)
downloaddrakx-backup-do-not-use-6b7aa28fc8bc41747b86976cd5a235bb951c95dc.tar
drakx-backup-do-not-use-6b7aa28fc8bc41747b86976cd5a235bb951c95dc.tar.gz
drakx-backup-do-not-use-6b7aa28fc8bc41747b86976cd5a235bb951c95dc.tar.bz2
drakx-backup-do-not-use-6b7aa28fc8bc41747b86976cd5a235bb951c95dc.tar.xz
drakx-backup-do-not-use-6b7aa28fc8bc41747b86976cd5a235bb951c95dc.zip
check(): only display "Errors:" if there is some errors
Diffstat (limited to 'perl-install/lang.pm')
-rw-r--r--perl-install/lang.pm20
1 files changed, 10 insertions, 10 deletions
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index 04f2437b4..43fcc2df4 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -1302,17 +1302,19 @@ sub png_lang_files() {
sub check() {
$^W = 0;
- my $ok = 1;
+ my ($warnings, $errors) = (0, 0);
my $warn = sub {
- print STDERR "$_[0]\n";
- };
- my $err = sub {
- &$warn;
- $ok = 0;
+ my ($msg, $b_is_error) = @_;
+ if ($b_is_error) {
+ print STDERR "\tErrors:\n" if !$errors++;
+ } else {
+ print STDERR "\tWarnings:\n" if !$warnings++;
+ }
+ print STDERR "$msg\n";
};
+ my $err = sub { $warn->($_[0], 'error') };
my @wanted_charsets = uniq map { l2charset($_) } list_langs();
- print "\tWarnings:\n";
$warn->("unused charset $_ (given in \%charsets, but not used in \%langs)") foreach difference2([ keys %charsets ], \@wanted_charsets);
$warn->("unused entry $_ in \%xim") foreach grep { !/UTF-8/ } difference2([ keys %IM_locale_specific_config ], [ map { l2locale($_) } list_langs() ]);
@@ -1333,8 +1335,6 @@ sub check() {
$warn->("no country corresponding to default locale $_->[1] of lang $_->[0]")
foreach grep { $_->[1] =~ /.._(..)/ && !exists $countries{$1} } map { [ $_, l2locale($_) ] } list_langs();
- print "\tErrors:\n";
-
$err->("invalid charset $_ ($_ does not exist in \%charsets)") foreach difference2(\@wanted_charsets, [ keys %charsets ]);
$err->("invalid charset $_ in \%charset2kde_font ($_ does not exist in \%charsets)") foreach difference2([ keys %charset2kde_font ], [ 'default', keys %charsets ]);
@@ -1348,7 +1348,7 @@ sub check() {
foreach grep { !member($_->[1], @locales) } map { [ $_, c2locale($_) ] } list_countries();
- exit($ok ? 0 : 1);
+ exit($errors ? 1 : 0);
}
1;