fd770bc17f464f4178626879412e580d2c25b834
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 Fix translation status tabl...

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

40) 	print "</tr>\n";
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

41) 	my $HTMLBASE = (defined $ENV{'HTMLBASE'} ? $ENV{'HTMLBASE'} : 'http://tor.eff.org/') . ($dir eq '.' ? '' : $dir.'/');
42) 	
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

43) 	for my $file (sort {$a cmp $b} keys %{$files{'en'}}) {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

44) 		my $obs = file_is_obsolete($dir, 'en', $file);
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

45) 		my $validatorlink = '';
46) 		my $htmlfile = $file;
47) 		if ($htmlfile =~ s/\.wml/.html/) {
48) 			$validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.en">validator</a>',
49) 				$HTMLBASE, $htmlfile;
50) 		}
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

53) 		printf '<td%s>Revision %s%s<br>
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

54) 		        <a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/en/%s?root=tor&amp;view=markup">HEAD</a>
55) 			%s',
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

56) 			($obs ? ' bgcolor="lightgrey"' : ''),
57) 			$files{'en'}->{$file}->{'rev'},
58) 			($obs ? ' (obsolete)' :''),
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

59) 			$file,
60) 			$validatorlink;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

63) 			my $color;
64) 			my $status;
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

65) 			if ($validatorlink) {
66) 				$validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.%s">validator</a>',
67) 					$HTMLBASE, $htmlfile, $lang;
68) 			};
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

70) 				my $all_info = '';
71) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
72) 					$all_info .= sprintf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
73) 				};
74) 
75) 				my $difflink;
76) 				if ($files{$lang}->{$file}->{'based'}  eq  $files{'en'}->{$file}->{'rev'}) {
77) 					$color='lightgreen';
78) 					$status='current';
79) 					$difflink='';
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

82) 					if ($files{$lang}->{$file}->{'based'} ne 'unknown') {
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

83) 						$difflink=sprintf '<br><a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/en/%s?root=tor&amp;r1=%s&amp;r2=%s">changes in original</a>',
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

84) 							$file, $files{$lang}->{$file}->{'based'}, $files{'en'}->{$file}->{'rev'};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

85) 						$color='yellow';
86) 					} else {
87) 						$difflink='';
88) 						$color='orange'
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

89) 					};
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) 				printf '<td bgcolor="%s">%s<br>
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

92) 					<a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/%s/%s?root=tor&amp;view=markup">HEAD</a><br>
93) 					%s
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

94) 					%s
95) 					%s</td>',
96) 					$color,
97) 					$status,
98) 					$lang, $file,
99) 					$all_info,
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

100) 					$difflink,
101) 					$validatorlink;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

108) 		};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

110) 	};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

112) 
113) 	for my $lang (@LANGUAGES) {
114) 		next if $lang eq 'en';
115) 		if (keys %{$files{$lang}} > 0) {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

118) 
119) 			print "<table border=1>\n";
120) 			print "<tr>\n";
121) 			print "<th>File</th>\n";
122) 			print "<th>Based on Revision</th>\n";
123) 			print "</tr>\n";
124) 			for my $file (sort {$a cmp $b} keys %{$files{$lang}}) {
125) 				print "<tr>";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

126) 				printf "<th>%s</th><td>", $file;
127) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
128) 					printf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
129) 				};
130) 				printf "</td>";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

133) 			};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

135) 		};
136) 	};
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

137) };
138) 
139) do_status('.', 0);
Peter Palfrader Add docs/ stuff

Peter Palfrader authored 18 years ago

140) do_status('docs', 1);
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

141) do_status('eff', 1);
142) do_status('gui', 1);
143)