60e9c1e4860ead4f9482cc0be3472fbcceec6b61
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) <:
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

13) sub do_status($$) {
14) 	my ($dir, $may_miss_dir) = @_;
15) 
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

16) 	my %files;
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

18) 	for my $lang (@LANGUAGES) {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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);
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

22) 		closedir DIR;
23) 
24) 		for my $file (@files) {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

26) 			if ($lang eq 'en') {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

28) 			} else {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

30) 			};
31) 		};
32) 	};
33) 
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

34) 	print "<h1>$dir</h1>\n";
35) 
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

36) 	print "<table border=1>\n";
37) 	print "<tr>\n";
38) 	print "<th>File</th>\n";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

40) 	print "</tr>\n";
41) 	for my $file (sort {$a cmp $b} keys %{$files{'en'}}) {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

53) 			my $color;
54) 			my $status;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

67) 					$status='not current';
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

68) 					if ($files{$lang}->{$file}->{'based'} ne 'unknown') {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

69) 						$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>',
70) 							$file, $files{$lang}->{$file}->{'based'}, $files{'en'}->{$file}->{'rev'};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

71) 						$color='yellow';
72) 					} else {
73) 						$difflink='';
74) 						$color='orange'
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

75) 					};
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

77) 				printf '<td bgcolor="%s">%s<br>
78) 					<a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/%s/%s?root=tor&view=markup">HEAD</a><br>
79) 					%s
80) 					%s</td>',
81) 					$color,
82) 					$status,
83) 					$lang, $file,
84) 					$all_info,
85) 					$difflink;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

92) 		};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

93) 		print "</tr>\n\n";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

94) 	};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

95) 	print "</table>\n\n\n";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

96) 
97) 	for my $lang (@LANGUAGES) {
98) 		next if $lang eq 'en';
99) 		if (keys %{$files{$lang}} > 0) {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

102) 
103) 			print "<table border=1>\n";
104) 			print "<tr>\n";
105) 			print "<th>File</th>\n";
106) 			print "<th>Based on Revision</th>\n";
107) 			print "</tr>\n";
108) 			for my $file (sort {$a cmp $b} keys %{$files{$lang}}) {
109) 				print "<tr>";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

110) 				printf "<th>%s</th><td>", $file;
111) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
112) 					printf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
113) 				};
114) 				printf "</td>";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

115) 				delete $files{$lang}->{$file};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

116) 				print "</tr>\n";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

117) 			};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

118) 			print "</table>\n\n";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

119) 		};
120) 	};
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

121) };
122) 
123) do_status('.', 0);
124) do_status('eff', 1);
125) do_status('gui', 1);
126)