Add sanity check for defined languages
Peter Palfrader

Peter Palfrader commited on 2005-12-21 01:43:11
Zeige 1 geänderte Dateien mit 11 Einfügungen und 1 Löschungen.

... ...
@@ -1,11 +1,21 @@
1 1
 #!wml
2 2
 <:
3
+	# Change both.  The array is ordered (for pages like translation status).
4
+	# The order of flasg in head is based on sort order of language name.
3 5
 	my @LANGUAGES = qw{en de it fr};
4 6
 	my %LANGUAGES = (
5 7
 		'en' => "English",
6 8
 		'de' => "Deutsch",
7 9
 		'it' => "Italiano",
8
-		'fr' => "Fran&ccedil;ais"
10
+		'fr' => "Fran&ccedil;ais",
9 11
 		);
10 12
 	our $WML_SRC_FILENAME;
13
+
14
+	# sanity check.
15
+	for my $lang (@LANGUAGES) {
16
+		die "Language $lang defined in \@LANGUAGES but not in \%LANGUAGES in perl-globals"
17
+			unless exists $LANGUAGES{$lang};
18
+	};
19
+	die "\@LANGUAGES and \%LANGUAGES have a different number of elements in perl-globals"
20
+		unless (scalar @LANGUAGES == scalar keys %LANGUAGES);
11 21
 :>
12 22