20cb78bfc238080e408e3d47cae878468ebb2c04
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

1) ## translation metadata
2) # Revision: $Revision$
3) 
4) #include "head.wmi" TITLE="Translation status"
Peter Palfrader also use "use warnings"

Peter Palfrader authored 19 years ago

5) #use "functions.wmi"
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

6) 
7) <div class="main-column">
8) 
9) <h2>Tor: Translation status</h2>
10) <hr />
11) 
12) <:
13) 	my %files;
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

14) 	my @warnings;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

15) 	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);
18) 		closedir DIR;
19) 
20) 		for my $file (@files) {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

21) 			$files{$lang}->{$file}->{'all'} = getMetadata($lang.'/'.$file);
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

22) 			if ($lang eq 'en') {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

23) 				$files{$lang}->{$file}->{'rev'} = translation_get_masterrevision_file($file);
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

24) 			} else {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

25) 				$files{$lang}->{$file}->{'based'} = translation_get_basedonrevision_langfile($lang, $file);
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

26) 			};
27) 		};
28) 	};
29) 
30) 	print "<table border=1>\n";
31) 	print "<tr>\n";
32) 	print "<th>File</th>\n";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

33) 	printf("<th>%s (%s)</th>\n", $_, $LANGUAGES{$_}) for (@LANGUAGES);
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

34) 	print "</tr>\n";
35) 	for my $file (sort {$a cmp $b} keys %{$files{'en'}}) {
Peter Palfrader Do not mark missing transla...

Peter Palfrader authored 19 years ago

36) 		my $obs = file_is_obsolete('en', $file);
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

37) 		print "<tr>";
38) 		printf "<th>%s</th>", $file;
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

39) 		printf '<td%s>Revision %s%s<br>
40) 		        <a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/en/%s?root=tor&view=markup">HEAD</a></td>',
41) 			($obs ? ' bgcolor="lightgrey"' : ''),
42) 			$files{'en'}->{$file}->{'rev'},
43) 			($obs ? ' (obsolete)' :''),
44) 			$file;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

45) 		for my $lang (@LANGUAGES) {
46) 			next if $lang eq 'en';
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

47) 			my $color;
48) 			my $status;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

49) 			if (exists $files{$lang}->{$file}) {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

50) 				my $all_info = '';
51) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
52) 					$all_info .= sprintf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
53) 				};
54) 
55) 				my $difflink;
56) 				if ($files{$lang}->{$file}->{'based'}  eq  $files{'en'}->{$file}->{'rev'}) {
57) 					$color='lightgreen';
58) 					$status='current';
59) 					$difflink='';
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

60) 				} else {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

61) 					$color='yellow';
62) 					$status='not current';
63) 					if ($files{$lang}->{$file} ne 'unknown') {
64) 						$difflink=sprintf '<br><a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/en/%s?root=tor&r1=%s&r2=%s">changes in original</a>',
65) 							$file, $files{$lang}->{$file}->{'based'}, $files{'en'}->{$file}->{'rev'};
66) 					};
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

67) 				};
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

68) 				printf '<td bgcolor="%s">%s<br>
69) 					<a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/%s/%s?root=tor&view=markup">HEAD</a><br>
70) 					%s
71) 					%s</td>',
72) 					$color,
73) 					$status,
74) 					$lang, $file,
75) 					$all_info,
76) 					$difflink;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

77) 			} else {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

78) 				$color=($obs ? 'lightgreen' : 'red');
79) 				$status='missing';
80) 				printf '<td bgcolor="%s">%s</td>', $color, $status;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

81) 			};
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

82) 			delete $files{$lang}->{$file};
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

83) 		};
84) 		print "</tr>";
85) 	};
86) 	print "</table>\n";
87) 
88) 	for my $lang (@LANGUAGES) {
89) 		next if $lang eq 'en';
90) 		if (keys %{$files{$lang}} > 0) {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

91) 			print "<p>";
92) 			printf "<h2>Additional files in %s (%s)</h2>\n", $lang, $LANGUAGES{$lang};
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

93) 
94) 			print "<table border=1>\n";
95) 			print "<tr>\n";
96) 			print "<th>File</th>\n";
97) 			print "<th>Based on Revision</th>\n";
98) 			print "</tr>\n";
99) 			for my $file (sort {$a cmp $b} keys %{$files{$lang}}) {
100) 				print "<tr>";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

101) 				printf "<th>%s</th><td>", $file;
102) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
103) 					printf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
104) 				};
105) 				printf "</td>";