Update translation status
Peter Palfrader

Peter Palfrader commited on 2006-01-27 01:03:01
Zeige 2 geänderte Dateien mit 29 Einfügungen und 17 Löschungen.

... ...
@@ -10,30 +10,36 @@
10 10
 <hr />
11 11
 
12 12
 <:
13
+sub do_status($$) {
14
+	my ($dir, $may_miss_dir) = @_;
15
+
13 16
 	my %files;
14 17
 	my @warnings;
15 18
 	for my $lang (@LANGUAGES) {
16
-		opendir(DIR, $lang) or die ("Cannot opendir $lang: $!\n");
17
-		my @files = grep { $_ ne '.' && $_ ne '..' && $_ =~ m/^[^.]/ && -f $lang.'/'.$_} readdir(DIR);
19
+		opendir(DIR, "$dir/$lang") or
20
+			$may_miss_dir or die ("Cannot opendir $dir/$lang: $!\n");
21
+		my @files = grep { $_ ne '.' && $_ ne '..' && $_ =~ m/^[^.]/ && -f "$dir/$lang/$_"} readdir(DIR);
18 22
 		closedir DIR;
19 23
 
20 24
 		for my $file (@files) {
21
-			$files{$lang}->{$file}->{'all'} = getMetadata($lang.'/'.$file);
25
+			$files{$lang}->{$file}->{'all'} = getMetadata("$dir/$lang/$file");
22 26
 			if ($lang eq 'en') {
23
-				$files{$lang}->{$file}->{'rev'} = translation_get_masterrevision_file($file);
27
+				$files{$lang}->{$file}->{'rev'} = translation_get_masterrevision_file($dir, $file);
24 28
 			} else {
25
-				$files{$lang}->{$file}->{'based'} = translation_get_basedonrevision_langfile($lang, $file);
29
+				$files{$lang}->{$file}->{'based'} = translation_get_basedonrevision_langfile($dir, $lang, $file);
26 30
 			};
27 31
 		};
28 32
 	};
29 33
 
34
+	print "<h1>$dir</h1>\n";
35
+
30 36
 	print "<table border=1>\n";
31 37
 	print "<tr>\n";
32 38
 	print "<th>File</th>\n";
33 39
 	printf("<th>%s (%s)</th>\n", $_, $LANGUAGES{$_}) for (@LANGUAGES);
34 40
 	print "</tr>\n";
35 41
 	for my $file (sort {$a cmp $b} keys %{$files{'en'}}) {
36
-		my $obs = file_is_obsolete('en', $file);
42
+		my $obs = file_is_obsolete($dir, 'en', $file);
37 43
 		print "<tr>";
38 44
 		printf "<th>%s</th>", $file;
39 45
 		printf '<td%s>Revision %s%s<br>
... ...
@@ -108,6 +114,12 @@
108 114
 			print "</table>\n";
109 115
 		};
110 116
 	};
117
+};
118
+
119
+do_status('.', 0);
120
+do_status('eff', 1);
121
+do_status('gui', 1);
122
+
111 123
 :>
112 124
 
113 125
 </div><!-- #main -->
... ...
@@ -29,9 +29,9 @@ sub getMetadata($) {
29 29
 	return \%data;
30 30
 };
31 31
 
32
-sub translation_get_masterrevision_file($) {
33
-	my ($page) = @_;
34
-	my $master = getMetadata("en/$page");
32
+sub translation_get_masterrevision_file($$) {
33
+	my ($dir, $page) = @_;
34
+	my $master = getMetadata("$dir/en/$page");
35 35
 
36 36
 	die ("Cannot find 'Revision' header in master's translation metadata of en/$page") unless exists $master->{'Revision'};
37 37
 
... ...
@@ -41,12 +41,12 @@ sub translation_get_masterrevision_file($) {
41 41
 	return $rev;
42 42
 };
43 43
 sub translation_get_masterrevision() {
44
-	translation_get_masterrevision_file($WML_SRC_FILENAME);
44
+	translation_get_masterrevision_file('.', $WML_SRC_FILENAME);
45 45
 };
46 46
 
47
-sub translation_get_basedonrevision_langfile($$) {
48
-	my ($lang, $page) = @_;
49
-	my $translation = getMetadata("$lang/$page");
47
+sub translation_get_basedonrevision_langfile($$$) {
48
+	my ($dir, $lang, $page) = @_;
49
+	my $translation = getMetadata("$dir/$lang/$page");
50 50
 
51 51
 	die ("Cannot find 'Based-On-Revision' header in translations's translation metadata of $lang/$page") unless exists $translation->{'Based-On-Revision'};
52 52
 
... ...
@@ -56,7 +56,7 @@ sub translation_get_basedonrevision_langfile($$) {
56 56
 	return $rev
57 57
 };
58 58
 sub translation_get_basedonrevision() {
59
-	translation_get_basedonrevision_langfile("$(LANG)", $WML_SRC_FILENAME);
59
+	translation_get_basedonrevision_langfile(".", "$(LANG)", $WML_SRC_FILENAME);
60 60
 };
61 61
 
62 62
 
... ...
@@ -64,9 +64,9 @@ sub translation_current() {
64 64
 	return (translation_get_masterrevision() eq translation_get_basedonrevision());
65 65
 };
66 66
 
67
-sub file_is_obsolete($$) {
68
-	my ($lang, $page) = @_;
69
-	my $translation = getMetadata("$lang/$page");
67
+sub file_is_obsolete($$$) {
68
+	my ($dir, $lang, $page) = @_;
69
+	my $translation = getMetadata("$dir/$lang/$page");
70 70
 	return (exists $translation->{'Status'} && ($translation->{'Status'} eq 'obsolete'))
71 71
 };
72 72
 
73 73