Simon Johansson commited on 2008-06-01 23:22:40
Zeige 1 geänderte Dateien mit 55 Einfügungen und 27 Löschungen.
| ... | ... |
@@ -17,10 +17,11 @@ |
| 17 | 17 |
<hr /> |
| 18 | 18 |
|
| 19 | 19 |
<: |
| 20 |
-sub do_status($$) {
|
|
| 21 |
- my ($dir, $may_miss_dir) = @_; |
|
| 22 |
- |
|
| 20 |
+sub do_status(\%$$) {
|
|
| 21 |
+ my $dir = $_[1]; |
|
| 22 |
+ my $may_miss_dir = $_[2]; |
|
| 23 | 23 |
my %files; |
| 24 |
+ |
|
| 24 | 25 |
my @warnings; |
| 25 | 26 |
for my $lang (@LANGUAGES) {
|
| 26 | 27 |
opendir(DIR, "$dir/$lang") or |
| ... | ... |
@@ -50,22 +51,12 @@ sub do_status($$) {
|
| 50 | 51 |
|
| 51 | 52 |
my $HTMLBASE = (defined $ENV{'HTMLBASE'} ? $ENV{'HTMLBASE'} : 'https://www.torproject.org/') . ($dir eq '.' ? '' : $dir.'/');
|
| 52 | 53 |
|
| 53 |
- |
|
| 54 |
- print "<a id=\"$dir\"></a>\n"; |
|
| 55 |
- print "<h1><a class=\"anchor\" href=\"#$dir\">$dir</a></h1>\n"; |
|
| 56 |
- |
|
| 57 | 54 |
for my $priority (@priorities) {
|
| 58 |
- print "<h2>Translation priority: $priority</h2>\n"; |
|
| 59 |
- print "<table border=1>\n"; |
|
| 60 |
- print "<tr>\n"; |
|
| 61 |
- print "<th>File</th>\n"; |
|
| 62 |
- printf("<th>%s (%s)</th>\n", $_, $LANGUAGES{$_}) for ('en', grep { $_ ne 'en' } @LANGUAGES);
|
|
| 63 |
- print "</tr>\n"; |
|
| 64 |
- |
|
| 65 | 55 |
for my $file (sort {$a cmp $b} keys %{$files{'en'}}) {
|
| 66 | 56 |
my $file_priority = $files{'en'}->{$file}->{'all'}->{'Translation-Priority'};
|
| 67 | 57 |
next if (defined $file_priority && $priority ne $file_priority); |
| 68 | 58 |
next if (!defined $file_priority && $priority ne 'none'); |
| 59 |
+ my $path = ($dir eq '.' ? '' : $dir.'/') . $file; |
|
| 69 | 60 |
|
| 70 | 61 |
my $obs = file_is_obsolete($dir, 'en', $file); |
| 71 | 62 |
my $validatorlink = ''; |
| ... | ... |
@@ -73,22 +64,27 @@ sub do_status($$) {
|
| 73 | 64 |
if ($htmlfile =~ s/\.wml/.html/) {
|
| 74 | 65 |
$validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.en">validator</a>', |
| 75 | 66 |
$HTMLBASE, $htmlfile; |
| 76 |
- } |
|
| 77 |
- print "<tr>"; |
|
| 78 |
- printf "<th>%s</th>", $file; |
|
| 79 |
- printf '<td%s>Revision %s%s<br> |
|
| 67 |
+ }; |
|
| 68 |
+ |
|
| 69 |
+ ${$_[0]}{$priority}->{$path}->{'data'} = sprintf '<th>%s</th>
|
|
| 70 |
+ <td%s>Revision %s%s<br> |
|
| 80 | 71 |
<a href="https://svn.torproject.org/cgi-bin/viewcvs.cgi/website/trunk/%sen/%s?root=Tor&view=markup">HEAD</a> |
| 81 | 72 |
%s', |
| 73 |
+ $path, |
|
| 82 | 74 |
($obs ? ' bgcolor="#D3D3D3"' : ''), |
| 83 | 75 |
$files{'en'}->{$file}->{'rev'},
|
| 84 | 76 |
($obs ? ' (obsolete)' :''), |
| 85 | 77 |
($dir eq '.' ? '' : $dir.'/'), |
| 86 | 78 |
$file, |
| 87 | 79 |
$validatorlink; |
| 80 |
+ |
|
| 81 |
+ ${$_[0]}{$priority}->{$path}->{'urgency'} = 0;
|
|
| 82 |
+ |
|
| 88 | 83 |
for my $lang (@LANGUAGES) {
|
| 89 | 84 |
next if $lang eq 'en'; |
| 90 | 85 |
my $color; |
| 91 | 86 |
my $status; |
| 87 |
+ #my $path = ($dir eq '.' ? '' : $dir.'/') . $file; |
|
| 92 | 88 |
if ($validatorlink) {
|
| 93 | 89 |
$validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.%s">validator</a>', |
| 94 | 90 |
$HTMLBASE, $htmlfile, $lang; |
| ... | ... |
@@ -96,6 +92,7 @@ sub do_status($$) {
|
| 96 | 92 |
if (exists $files{$lang}->{$file}) {
|
| 97 | 93 |
my $all_info = ''; |
| 98 | 94 |
for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) {
|
| 95 |
+ next if $key eq 'Translation-Priority'; |
|
| 99 | 96 |
$all_info .= sprintf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key};
|
| 100 | 97 |
}; |
| 101 | 98 |
|
| ... | ... |
@@ -114,8 +111,11 @@ sub do_status($$) {
|
| 114 | 111 |
$difflink=''; |
| 115 | 112 |
$color='#FFA500'; |
| 116 | 113 |
}; |
| 114 |
+ |
|
| 115 |
+ ${$_[0]}{$priority}->{$path}->{'urgency'} += 1;
|
|
| 117 | 116 |
}; |
| 118 |
- printf '<td bgcolor="%s">%s<br> |
|
| 117 |
+ |
|
| 118 |
+ ${$_[0]}{$priority}->{$path}->{'data'} .= sprintf '<td bgcolor="%s">%s<br>
|
|
| 119 | 119 |
<a href="https://svn.torproject.org/cgi-bin/viewcvs.cgi/website/trunk/%s%s/%s?root=Tor&view=markup">HEAD</a><br> |
| 120 | 120 |
%s |
| 121 | 121 |
%s |
| ... | ... |
@@ -128,16 +128,17 @@ sub do_status($$) {
|
| 128 | 128 |
$difflink, |
| 129 | 129 |
$validatorlink; |
| 130 | 130 |
} else {
|
| 131 |
+ #my $path = ($dir eq '.' ? '' : $dir.'/') . $file; |
|
| 131 | 132 |
$color=(($obs or $priority eq 'none') ? |
| 132 | 133 |
'#90EE90' : 'red'); |
| 133 | 134 |
$status='missing'; |
| 134 |
- printf '<td bgcolor="%s">%s</td>', $color, $status; |
|
| 135 |
+ |
|
| 136 |
+ ${$_[0]}{$priority}->{$path}->{'data'} .= sprintf '<td bgcolor="%s">%s</td>', $color, $status;
|
|
| 137 |
+ ${$_[0]}{$priority}->{$path}->{'urgency'} += ($obs or $priority eq 'none') ? 0 : 2;
|
|
| 135 | 138 |
}; |
| 136 | 139 |
delete $files{$lang}->{$file};
|
| 137 | 140 |
}; |
| 138 |
- print "</tr>\n\n"; |
|
| 139 | 141 |
}; |
| 140 |
- print "</table>\n\n\n"; |
|
| 141 | 142 |
}; |
| 142 | 143 |
|
| 143 | 144 |
for my $lang (@LANGUAGES) {
|
| ... | ... |
@@ -167,11 +168,38 @@ sub do_status($$) {
|
| 167 | 168 |
}; |
| 168 | 169 |
}; |
| 169 | 170 |
|
| 170 |
-do_status('.', 0);
|
|
| 171 |
-do_status('docs', 1);
|
|
| 172 |
-do_status('torbrowser', 1);
|
|
| 173 |
-#do_status('eff', 1);
|
|
| 174 |
-#do_status('gui', 1);
|
|
| 171 |
+sub sort_and_print(\%) {
|
|
| 172 |
+ my %rows = %{$_[0]};
|
|
| 173 |
+ |
|
| 174 |
+ for my $priority (sort {$a cmp $b} keys %rows) {
|
|
| 175 |
+ print "<h2>Translation priority: $priority</h2>\n"; |
|
| 176 |
+ |
|
| 177 |
+ print "<table border=1>\n"; |
|
| 178 |
+ print "<tr>\n"; |
|
| 179 |
+ print "<th>File</th>\n"; |
|
| 180 |
+ printf("<th>%s (%s)</th>\n", $_, $LANGUAGES{$_}) for ('en', grep { $_ ne 'en' } @LANGUAGES);
|
|
| 181 |
+ print "</tr>\n"; |
|
| 182 |
+ |
|
| 183 |
+ for my $row (sort {$rows{$priority}->{$b}->{'urgency'} <=> $rows{$priority}->{$a}->{'urgency'}} keys %{$rows{$priority}}) {
|
|
| 184 |
+ print "<tr>"; |
|
| 185 |
+ print $rows{$priority}->{$row}->{'data'};
|
|
| 186 |
+ delete ${$_[0]}{$priority}->{$row};
|
|
| 187 |
+ print "</tr>\n\n"; |
|
| 188 |
+ }; |
|
| 189 |
+ |
|
| 190 |
+ print "</table><br>\n\n\n"; |
|
| 191 |
+ }; |
|
| 192 |
+}; |
|
| 193 |
+ |
|
| 194 |
+# accumulate the table rows, then sort and print them |
|
| 195 |
+my %table_rows; |
|
| 196 |
+do_status(%table_rows, '.', 0); |
|
| 197 |
+do_status(%table_rows, 'docs', 1); |
|
| 198 |
+do_status(%table_rows, 'torbrowser', 1); |
|
| 199 |
+#do_status(%table_data, 'eff', 1); |
|
| 200 |
+#do_status(%table_data, 'gui', 1); |
|
| 201 |
+sort_and_print(%table_rows); |
|
| 202 |
+ |
|
| 175 | 203 |
|
| 176 | 204 |
:> |
| 177 | 205 |
|
| 178 | 206 |