d9ca9da477c427e0f59e1d055c9efabced8969f0
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>
Roger Dingledine update the translation page...

Roger Dingledine authored 18 years ago

54) 		        <a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/trunk/%sen/%s?root=tor&amp;view=markup">HEAD</a>
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

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 Fix viewcvs links for subdirs

Peter Palfrader authored 18 years ago

59) 			($dir eq '.' ? '' : $dir.'/'),
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

83) 					if ($files{$lang}->{$file}->{'based'} ne 'unknown') {
Roger Dingledine update the translation page...

Roger Dingledine authored 18 years ago

84) 						$difflink=sprintf '<br><a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/trunk/%sen/%s?root=tor&amp;r1=%s&amp;r2=%s">changes in original</a>',
Peter Palfrader Fix viewcvs links for subdirs

Peter Palfrader authored 18 years ago

85) 							($dir eq '.' ? '' : $dir.'/'), $file, $files{$lang}->{$file}->{'based'}, $files{'en'}->{$file}->{'rev'};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

90) 					};
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

92) 				printf '<td bgcolor="%s">%s<br>
Roger Dingledine update the translation page...

Roger Dingledine authored 18 years ago

93) 					<a href="http://cvs.seul.org/viewcvs/viewcvs.cgi/website/trunk/%s%s/%s?root=tor&amp;view=markup">HEAD</a><br>
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

94) 					%s
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

95) 					%s
96) 					%s</td>',
97) 					$color,
98) 					$status,
Peter Palfrader Fix viewcvs links for subdirs

Peter Palfrader authored 18 years ago

99) 					($dir eq '.' ? '' : $dir.'/'),
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

100) 					$lang, $file,
101) 					$all_info,
Peter Palfrader We don't claim to do XML an...

Peter Palfrader authored 18 years ago

102) 					$difflink,
103) 					$validatorlink;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

109) 			delete $files{$lang}->{$file};
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 "</tr>\n\n";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

112) 	};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

135) 			};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

137) 		};
138) 	};
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

143) do_status('eff', 1);
144) do_status('gui', 1);
145)