4a22fd2cf45fa189a8b6940108d09e0137c3c16c
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

1) ## translation metadata
2) # Revision: $Revision$
3) 
Peter Palfrader Add a note to the kind tran...

Peter Palfrader authored 18 years ago

4) # Note to translators:
5) # translating this page is probably not a good idea, and it never was intended to be translated.
6) # it contains lots of programming logic, which you would have to duplicate, and it's probably
7) # useful only to other translators which most likely will know a bit of english.
8) #
9) # Thanks for your hard work, improve the other pages instead. :)   -- weasel
10) 
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

11) #include "head.wmi" TITLE="Translation status"
Peter Palfrader also use "use warnings"

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

13) 
14) <div class="main-column">
15) 
16) <h2>Tor: Translation status</h2>
17) <hr />
18) 
19) <:
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

20) sub do_status($$) {
21) 	my ($dir, $may_miss_dir) = @_;
22) 
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

26) 		opendir(DIR, "$dir/$lang") or
27) 			$may_miss_dir or die ("Cannot opendir $dir/$lang: $!\n");
28) 		my @files = grep { $_ ne '.' && $_ ne '..' && $_ =~ m/^[^.]/ && -f "$dir/$lang/$_"} readdir(DIR);
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

29) 		closedir DIR;
30) 
31) 		for my $file (@files) {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

35) 			} else {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

37) 			};
38) 		};
39) 	};
40) 
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

43) 	print "<table border=1>\n";
44) 	print "<tr>\n";
45) 	print "<th>File</th>\n";
Peter Palfrader Fix translation status tabl...

Peter Palfrader authored 18 years ago

46) 	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

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

52) 		my $validatorlink = '';
53) 		my $htmlfile = $file;
54) 		if ($htmlfile =~ s/\.wml/.html/) {
55) 			$validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.en">validator</a>',
56) 				$HTMLBASE, $htmlfile;
57) 		}
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

60) 		printf '<td%s>Revision %s%s<br>
Roger Dingledine update the translation page...

Roger Dingledine authored 18 years ago

61) 		        <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

62) 			%s',
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

63) 			($obs ? ' bgcolor="lightgrey"' : ''),
64) 			$files{'en'}->{$file}->{'rev'},
65) 			($obs ? ' (obsolete)' :''),
Peter Palfrader Fix viewcvs links for subdirs

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

67) 			$file,
68) 			$validatorlink;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

78) 				my $all_info = '';
79) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
80) 					$all_info .= sprintf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
81) 				};
82) 
83) 				my $difflink;
84) 				if ($files{$lang}->{$file}->{'based'}  eq  $files{'en'}->{$file}->{'rev'}) {
85) 					$color='lightgreen';
86) 					$status='current';
87) 					$difflink='';
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Roger Dingledine authored 18 years ago

91) 						$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

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

Peter Palfrader authored 18 years ago

93) 						$color='yellow';
94) 					} else {
95) 						$difflink='';
96) 						$color='orange'
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

97) 					};
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Roger Dingledine authored 18 years ago

100) 					<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

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

Peter Palfrader authored 19 years ago

102) 					%s
103) 					%s</td>',
104) 					$color,
105) 					$status,
Peter Palfrader Fix viewcvs links for subdirs

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

109) 					$difflink,
110) 					$validatorlink;
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

119) 	};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

121) 
122) 	for my $lang (@LANGUAGES) {
123) 		next if $lang eq 'en';
124) 		if (keys %{$files{$lang}} > 0) {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

127) 
128) 			print "<table border=1>\n";
129) 			print "<tr>\n";
130) 			print "<th>File</th>\n";
131) 			print "<th>Based on Revision</th>\n";
132) 			print "</tr>\n";
133) 			for my $file (sort {$a cmp $b} keys %{$files{$lang}}) {
134) 				print "<tr>";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

135) 				printf "<th>%s</th><td>", $file;
136) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
137) 					printf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
138) 				};
139) 				printf "</td>";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

142) 			};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

144) 		};
145) 	};
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

146) };
147) 
148) do_status('.', 0);
Peter Palfrader Add docs/ stuff

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

150) do_status('eff', 1);
151) do_status('gui', 1);
152)