aa4ebe5e8b865a9090f102e5fd3bf2bef671c1ae
Peter Palfrader Add translation-status page

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 17 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) 
Ruben Garcia Added utf8 charset

Ruben Garcia authored 15 years ago

11) #include "head.wmi" TITLE="Tor: Translation status" CHARSET="UTF-8"
Peter Palfrader also use "use warnings"

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

13) 
14) <div class="main-column">
15) 
16) <h2>Tor: Translation status</h2>
17) <hr />
18) 
19) <:
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

20) sub do_status(\%$$) {
21) 	my $dir = $_[1];
22) 	my $may_miss_dir = $_[2];
Peter Palfrader Add translation-status page

Peter Palfrader authored 18 years ago

23) 	my %files;
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

24) 
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

26) 	for my $lang (@LANGUAGES) {
Andrew Lewman Apply patch from black peng...

Andrew Lewman authored 14 years ago

27) 		my $dir_opened = opendir(DIR, "$dir/$lang");
28) 
29) 		if (! $dir_opened) {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

30) 			$may_miss_dir or die ("Cannot opendir $dir/$lang: $!\n");
Andrew Lewman Apply patch from black peng...

Andrew Lewman authored 14 years ago

31) 			next;
32) 		}
33) 
Bogdan Drozdowski Translation/mainetance upda...

Bogdan Drozdowski authored 16 years ago

34) 		my @files = grep { $_ ne '.' && $_ ne '..' &&
Roger Dingledine patch from mfr to let the t...

Roger Dingledine authored 15 years ago

35) 			$_ !~ /tor-manual/i && $_ !~ /translation-status/i && $_ =~ m/^[^.]/ && -f "$dir/$lang/$_"} readdir(DIR);
Peter Palfrader Add translation-status page

Peter Palfrader authored 18 years ago

36) 		closedir DIR;
37) 
38) 		for my $file (@files) {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

42) 			} else {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

44) 			};
45) 		};
46) 	};
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

47) 	my %priorities;
48) 	for my $file (keys %{$files{'en'}}) {
49) 		my $p = $files{'en'}->{$file}->{'all'}->{'Translation-Priority'};
50) 		if (defined $p) {
51) 			$priorities{$p} = 1;
52) 		};
53) 	};
54) 	my @priorities = sort {$a cmp $b} keys %priorities;
Roger Dingledine name the "other" section "n...

Roger Dingledine authored 16 years ago

55) 	push @priorities, 'none';
Peter Palfrader Add translation-status page

Peter Palfrader authored 18 years ago

56) 
Andrew Lewman Updated the url to www.tp.o...

Andrew Lewman authored 16 years ago

57) 	my $HTMLBASE = (defined $ENV{'HTMLBASE'} ? $ENV{'HTMLBASE'} : 'https://www.torproject.org/') . ($dir eq '.' ? '' : $dir.'/');
Bogdan Drozdowski Translation/mainetance upda...

Bogdan Drozdowski authored 16 years ago

58) 
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

59) 	for my $priority (@priorities) {
60) 		for my $file (sort {$a cmp $b} keys %{$files{'en'}}) {
61) 			my $file_priority = $files{'en'}->{$file}->{'all'}->{'Translation-Priority'};
62) 			next if (defined $file_priority && $priority ne $file_priority);
Roger Dingledine name the "other" section "n...

Roger Dingledine authored 16 years ago

63) 			next if (!defined $file_priority && $priority ne 'none');
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

64) 			my $path = ($dir eq '.' ? '' : $dir.'/') . $file;
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

65) 
66) 			my $obs = file_is_obsolete($dir, 'en', $file);
67) 			my $validatorlink = '';
68) 			my $htmlfile = $file;
69) 			if ($htmlfile =~ s/\.wml/.html/) {
70) 				$validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.en">validator</a>',
71) 					$HTMLBASE, $htmlfile;
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

72) 			};
73) 
Simon Johansson Added file information and...

Simon Johansson authored 15 years ago

74) 			my $cell_path = sprintf '<th>%s</th>', $path;
75) 			my $cell_en = sprintf '<td%s>Revision %s%s<br>
Pei Hanru The script for viewing chan...

Pei Hanru authored 15 years ago

76) 				<a href="https://svn.torproject.org/cgi-bin/viewvc.cgi/website/trunk/%sen/%s?root=Tor&amp;view=markup">HEAD</a>
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

77) 				%s',
78) 				($obs ? ' bgcolor="#D3D3D3"' : ''),
79) 				$files{'en'}->{$file}->{'rev'},
80) 				($obs ? ' (obsolete)' :''),
81) 				($dir eq '.' ? '' : $dir.'/'),
82) 				$file,
83) 				$validatorlink;
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

84) 
Simon Johansson Added file information and...

Simon Johansson authored 15 years ago

85) 			${$_[0]}{$priority}->{$path}->{'data'} = $cell_path . $cell_en;
Roger Dingledine hm. even though it's perl,...

Roger Dingledine authored 15 years ago

86) 			# Assign high urgency if it's *.wmi, else init to 0
Roger Dingledine hack translation-status to...

Roger Dingledine authored 15 years ago

87) 			if ($file =~ /.wmi$/) {
88) 			  ${$_[0]}{$priority}->{$path}->{'urgency'} = 1000;
89) 			} else {
90) 			  ${$_[0]}{$priority}->{$path}->{'urgency'} = 0;
91) 			}
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

92) 
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

93) 			for my $lang (@LANGUAGES) {
94) 				next if $lang eq 'en';
95) 				my $color;
96) 				my $status;
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

97) 				#my $path = ($dir eq '.' ? '' : $dir.'/') . $file;
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

98) 				if ($validatorlink) {
99) 					$validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.%s">validator</a>',
100) 						$HTMLBASE, $htmlfile, $lang;
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

101) 				};
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

102) 				if (exists $files{$lang}->{$file}) {
103) 					my $all_info = '';
104) 					for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

105) 						next if $key eq 'Translation-Priority';
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

106) 						$all_info .= sprintf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
107) 					};
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

108) 
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

109) 					my $difflink;
110) 					if ($files{$lang}->{$file}->{'based'}  eq  $files{'en'}->{$file}->{'rev'}) {
111) 						$color='#90EE90';
112) 						$status='current';
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

113) 						$difflink='';
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

114) 					} else {
115) 						$status='not current';
116) 						if ($files{$lang}->{$file}->{'based'} ne 'unknown') {
Pei Hanru The script for viewing chan...

Pei Hanru authored 15 years ago

117) 							$difflink=sprintf '<br><a href="https://svn.torproject.org/cgi-bin/viewvc.cgi/website/trunk/%sen/%s?root=Tor&amp;r1=%s&amp;r2=%s">changes in original</a>',
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

118) 								($dir eq '.' ? '' : $dir.'/'), $file, $files{$lang}->{$file}->{'based'}, $files{'en'}->{$file}->{'rev'};
119) 							$color='yellow';
120) 						} else {
121) 							$difflink='';
122) 							$color='#FFA500';
123) 						};
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

124) 
125) 						${$_[0]}{$priority}->{$path}->{'urgency'} += 1;
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

126) 					};
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

127) 
128) 					${$_[0]}{$priority}->{$path}->{'data'} .= sprintf '<td bgcolor="%s">%s<br>
Pei Hanru The script for viewing chan...

Pei Hanru authored 15 years ago

129) 						<a href="https://svn.torproject.org/cgi-bin/viewvc.cgi/website/trunk/%s%s/%s?root=Tor&amp;view=markup">HEAD</a><br>
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

130) 						%s
131) 						%s
132) 						%s</td>',
133) 						$color,
134) 						$status,
135) 						($dir eq '.' ? '' : $dir.'/'),
136) 						$lang, $file,
137) 						$all_info,
138) 						$difflink,
139) 						$validatorlink;
140) 				} else {
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

141) 					#my $path = ($dir eq '.' ? '' : $dir.'/') . $file;
Roger Dingledine if there's no translation f...

Roger Dingledine authored 16 years ago

142) 					$color=(($obs or $priority eq 'none') ?
143) 						'#90EE90' : 'red');
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

144) 					$status='missing';
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

145) 
146) 					${$_[0]}{$priority}->{$path}->{'data'} .= sprintf '<td bgcolor="%s">%s</td>', $color, $status;
147) 					${$_[0]}{$priority}->{$path}->{'urgency'} += ($obs or $priority eq 'none') ? 0 : 2;
Peter Palfrader Add translation-status page

Peter Palfrader authored 18 years ago

148) 				};
Peter Palfrader Implement translation prior...

Peter Palfrader authored 16 years ago

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

Peter Palfrader authored 18 years ago

150) 			};
Simon Johansson Added file information and...

Simon Johansson authored 15 years ago

151) 
152) 			${$_[0]}{$priority}->{$path}->{'data'} .= $cell_en . $cell_path;
Peter Palfrader Add translation-status page

Peter Palfrader authored 18 years ago

153) 		};
154) 	};
155) 
156) 	for my $lang (@LANGUAGES) {
157) 		next if $lang eq 'en';
158) 		if (keys %{$files{$lang}} > 0) {
Bogdan Drozdowski Translation/mainetance upda...

Bogdan Drozdowski authored 16 years ago

159) #			print "<p>";
160) 			print "<br><br>";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

162) 
163) 			print "<table border=1>\n";
164) 			print "<tr>\n";
165) 			print "<th>File</th>\n";
166) 			print "<th>Based on Revision</th>\n";
167) 			print "</tr>\n";
168) 			for my $file (sort {$a cmp $b} keys %{$files{$lang}}) {
169) 				print "<tr>";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

170) 				printf "<th>%s</th><td>", $file;
171) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
172) 					printf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
173) 				};
174) 				printf "</td>";
Peter Palfrader Add translation-status page

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

177) 			};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 18 years ago

179) 		};
180) 	};
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

181) };
182) 
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

183) sub sort_and_print(\%) {
184) 	my %rows = %{$_[0]};
185) 
186) 	for my $priority (sort {$a cmp $b} keys %rows) {
187) 		print "<h2>Translation priority: $priority</h2>\n";
188) 
189) 		print "<table border=1>\n";
190) 		print "<tr>\n";
191) 		print "<th>File</th>\n";
Simon Johansson Added file information and...

Simon Johansson authored 15 years ago

192) 		printf("<th>%s (%s)</th>\n", $_, $LANGUAGES{$_}) for ('en', grep({ $_ ne 'en' } @LANGUAGES), 'en');
193) 		print "<th>File</th>\n";
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

194) 		print "</tr>\n";
195) 
196) 		for my $row (sort {$rows{$priority}->{$b}->{'urgency'} <=> $rows{$priority}->{$a}->{'urgency'}} keys %{$rows{$priority}}) {
197) 			print "<tr>";
198) 			print $rows{$priority}->{$row}->{'data'};
199) 			delete ${$_[0]}{$priority}->{$row};
200) 			print "</tr>\n\n";
201) 		};
202) 
203) 		print "</table><br>\n\n\n";
204) 	};
205) };
206) 
207) # accumulate the table rows, then sort and print them
208) my %table_rows;
209) do_status(%table_rows, '.', 0);
210) do_status(%table_rows, 'docs', 1);
211) do_status(%table_rows, 'torbrowser', 1);
Roger Dingledine ok, now it builds. great.

Roger Dingledine authored 15 years ago

212) do_status(%table_rows, 'torbutton', 1);
Roger Dingledine ugh. teach me to blindly ap...

Roger Dingledine authored 15 years ago

213) do_status(%table_rows, 'tordnsel', 1);
214) do_status(%table_rows, 'projects', 1);
Roger Dingledine make the torvm stuff build

Roger Dingledine authored 15 years ago

215) do_status(%table_rows, 'torvm', 1);
Roger Dingledine add the press directory to...

Roger Dingledine authored 15 years ago

216) do_status(%table_rows, 'press', 1);
Roger Dingledine when we have gettor pages w...

Roger Dingledine authored 15 years ago

217) do_status(%table_rows, 'gettor', 1);
Simon Johansson translation-status is now s...

Simon Johansson authored 15 years ago

218) #do_status(%table_data, 'eff', 1);
219) #do_status(%table_data, 'gui', 1);
220) sort_and_print(%table_rows);
221) 
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

222)