b0945c143e3791a43b7fa3ddd095b6514fd13051
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) 
Ruben Garcia Added utf8 charset

Ruben Garcia authored 16 years ago

11) #include "head.wmi" TITLE="Tor: Translation status" CHARSET="UTF-8"
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) <:
Simon Johansson translation-status is now s...

Simon Johansson authored 16 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 19 years ago

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

Simon Johansson authored 16 years ago

24) 
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

27) 		opendir(DIR, "$dir/$lang") or
28) 			$may_miss_dir or die ("Cannot opendir $dir/$lang: $!\n");
Bogdan Drozdowski Translation/mainetance upda...

Bogdan Drozdowski authored 17 years ago

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

Roger Dingledine authored 16 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

37) 			} else {
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

39) 			};
40) 		};
41) 	};
Peter Palfrader Implement translation prior...

Peter Palfrader authored 17 years ago

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

Roger Dingledine authored 17 years ago

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

Peter Palfrader authored 19 years ago

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

Andrew Lewman authored 17 years ago

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

Bogdan Drozdowski authored 17 years ago

53) 
Peter Palfrader Implement translation prior...

Peter Palfrader authored 17 years ago

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

Roger Dingledine authored 17 years ago

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

Simon Johansson authored 16 years ago

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

Peter Palfrader authored 17 years ago

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

Simon Johansson authored 16 years ago

67) 			};
68) 
Simon Johansson Added file information and...

Simon Johansson authored 16 years ago

69) 			my $cell_path = sprintf '<th>%s</th>', $path;
70) 			my $cell_en = sprintf '<td%s>Revision %s%s<br>
Peter Palfrader Use svn.tpo's instead of se...

Peter Palfrader authored 16 years ago

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

Peter Palfrader authored 17 years ago

72) 				%s',
73) 				($obs ? ' bgcolor="#D3D3D3"' : ''),
74) 				$files{'en'}->{$file}->{'rev'},
75) 				($obs ? ' (obsolete)' :''),
76) 				($dir eq '.' ? '' : $dir.'/'),
77) 				$file,
78) 				$validatorlink;
Simon Johansson translation-status is now s...

Simon Johansson authored 16 years ago

79) 
Simon Johansson Added file information and...

Simon Johansson authored 16 years ago

80) 			${$_[0]}{$priority}->{$path}->{'data'} = $cell_path . $cell_en;
Roger Dingledine hack translation-status to...

Roger Dingledine authored 15 years ago

81) 			if ($file =~ /.wmi$/) {
82) 			  ${$_[0]}{$priority}->{$path}->{'urgency'} = 1000;
83) 			} else {
84) 			  ${$_[0]}{$priority}->{$path}->{'urgency'} = 0;
85) 			}
Simon Johansson translation-status is now s...

Simon Johansson authored 16 years ago

86) 
Peter Palfrader Implement translation prior...

Peter Palfrader authored 17 years ago

87) 			for my $lang (@LANGUAGES) {
88) 				next if $lang eq 'en';
89) 				my $color;
90) 				my $status;
Simon Johansson translation-status is now s...

Simon Johansson authored 16 years ago

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

Peter Palfrader authored 17 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 17 years ago

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

Simon Johansson authored 16 years ago

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

Peter Palfrader authored 17 years ago

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

Peter Palfrader authored 19 years ago

102) 
Peter Palfrader Implement translation prior...

Peter Palfrader authored 17 years ago

103) 					my $difflink;
104) 					if ($files{$lang}->{$file}->{'based'}  eq  $files{'en'}->{$file}->{'rev'}) {
105) 						$color='#90EE90';
106) 						$status='current';
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 17 years ago

108) 					} else {
109) 						$status='not current';
110) 						if ($files{$lang}->{$file}->{'based'} ne 'unknown') {
Peter Palfrader Use svn.tpo's instead of se...

Peter Palfrader authored 16 years ago

111) 							$difflink=sprintf '<br><a href="https://svn.torproject.org/cgi-bin/viewcvs.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 17 years ago

112) 								($dir eq '.' ? '' : $dir.'/'), $file, $files{$lang}->{$file}->{'based'}, $files{'en'}->{$file}->{'rev'};
113) 							$color='yellow';
114) 						} else {
115) 							$difflink='';
116) 							$color='#FFA500';
117) 						};
Simon Johansson translation-status is now s...

Simon Johansson authored 16 years ago

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

Peter Palfrader authored 19 years ago

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

Simon Johansson authored 16 years ago

121) 
122) 					${$_[0]}{$priority}->{$path}->{'data'} .= sprintf '<td bgcolor="%s">%s<br>
Peter Palfrader Use svn.tpo's instead of se...

Peter Palfrader authored 16 years ago

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

Peter Palfrader authored 17 years ago

124) 						%s
125) 						%s
126) 						%s</td>',
127) 						$color,
128) 						$status,
129) 						($dir eq '.' ? '' : $dir.'/'),
130) 						$lang, $file,
131) 						$all_info,
132) 						$difflink,
133) 						$validatorlink;
134) 				} else {
Simon Johansson translation-status is now s...

Simon Johansson authored 16 years ago

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

Roger Dingledine authored 16 years ago

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

Peter Palfrader authored 17 years ago

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

Simon Johansson authored 16 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 17 years ago

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

Peter Palfrader authored 19 years ago

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

Simon Johansson authored 16 years ago

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

Peter Palfrader authored 19 years ago

147) 		};
148) 	};
149) 
150) 	for my $lang (@LANGUAGES) {
151) 		next if $lang eq 'en';
152) 		if (keys %{$files{$lang}} > 0) {
Bogdan Drozdowski Translation/mainetance upda...

Bogdan Drozdowski authored 17 years ago

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

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 19 years ago

156) 
157) 			print "<table border=1>\n";
158) 			print "<tr>\n";
159) 			print "<th>File</th>\n";
160) 			print "<th>Based on Revision</th>\n";
161) 			print "</tr>\n";
162) 			for my $file (sort {$a cmp $b} keys %{$files{$lang}}) {
163) 				print "<tr>";
Peter Palfrader Make translation status mor...

Peter Palfrader authored 19 years ago

164) 				printf "<th>%s</th><td>", $file;
165) 				for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
166) 					printf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
167) 				};
168) 				printf "</td>";
Peter Palfrader Add translation-status page

Peter Palfrader authored 19 years ago

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

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

171) 			};
Peter Palfrader misc translation fixes

Peter Palfrader authored 18 years ago

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

Peter Palfrader authored 19 years ago

173) 		};
174) 	};
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

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

Simon Johansson authored 16 years ago

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

Simon Johansson authored 16 years ago

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

Simon Johansson authored 16 years ago

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

Roger Dingledine authored 16 years ago

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

Roger Dingledine authored 16 years ago

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

Roger Dingledine authored 16 years ago

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

Roger Dingledine authored 15 years ago

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

Roger Dingledine authored 15 years ago

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

Simon Johansson authored 16 years ago

212) #do_status(%table_data, 'eff', 1);
213) #do_status(%table_data, 'gui', 1);
214) sort_and_print(%table_rows);
215) 
Peter Palfrader Update translation status

Peter Palfrader authored 18 years ago

216)