Andrew Lewman commited on 2010-08-18 22:51:20
Zeige 1 geänderte Dateien mit 0 Einfügungen und 228 Löschungen.
... | ... |
@@ -1,228 +0,0 @@ |
1 |
-## translation metadata |
|
2 |
-# Revision: $Revision$ |
|
3 |
- |
|
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 |
- |
|
11 |
-#include "head.wmi" TITLE="Tor: Translation status" CHARSET="UTF-8" |
|
12 |
-#use "functions.wmi" |
|
13 |
- |
|
14 |
-<div class="main-column"> |
|
15 |
- |
|
16 |
-<h2>Tor: Translation status</h2> |
|
17 |
-<hr /> |
|
18 |
- |
|
19 |
-<: |
|
20 |
-sub do_status(\%$$) { |
|
21 |
- my $dir = $_[1]; |
|
22 |
- my $may_miss_dir = $_[2]; |
|
23 |
- my %files; |
|
24 |
- |
|
25 |
- my @warnings; |
|
26 |
- for my $lang (@LANGUAGES) { |
|
27 |
- my $dir_opened = opendir(DIR, "$dir/$lang"); |
|
28 |
- |
|
29 |
- if (! $dir_opened) { |
|
30 |
- $may_miss_dir or die ("Cannot opendir $dir/$lang: $!\n"); |
|
31 |
- next; |
|
32 |
- } |
|
33 |
- |
|
34 |
- my @files = grep { $_ ne '.' && $_ ne '..' && |
|
35 |
- $_ !~ /tor-manual/i && $_ !~ /translation-status/i && $_ =~ m/^[^.]/ && -f "$dir/$lang/$_"} readdir(DIR); |
|
36 |
- closedir DIR; |
|
37 |
- |
|
38 |
- for my $file (@files) { |
|
39 |
- $files{$lang}->{$file}->{'all'} = getMetadata("$dir/$lang/$file"); |
|
40 |
- if ($lang eq 'en') { |
|
41 |
- $files{$lang}->{$file}->{'rev'} = translation_get_masterrevision_file($dir, $file); |
|
42 |
- } else { |
|
43 |
- $files{$lang}->{$file}->{'based'} = translation_get_basedonrevision_langfile($dir, $lang, $file); |
|
44 |
- }; |
|
45 |
- }; |
|
46 |
- }; |
|
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; |
|
55 |
- push @priorities, 'none'; |
|
56 |
- |
|
57 |
- my $HTMLBASE = (defined $ENV{'HTMLBASE'} ? $ENV{'HTMLBASE'} : 'https://www.torproject.org/') . ($dir eq '.' ? '' : $dir.'/'); |
|
58 |
- |
|
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); |
|
63 |
- next if (!defined $file_priority && $priority ne 'none'); |
|
64 |
- my $path = ($dir eq '.' ? '' : $dir.'/') . $file; |
|
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; |
|
72 |
- }; |
|
73 |
- |
|
74 |
- my $cell_path = sprintf '<th>%s</th>', $path; |
|
75 |
- my $cell_en = sprintf '<td%s>Revision %s%s<br> |
|
76 |
- <a href="https://svn.torproject.org/cgi-bin/viewvc.cgi/website/trunk/%sen/%s?root=Tor&view=markup">HEAD</a> |
|
77 |
- %s', |
|
78 |
- ($obs ? ' bgcolor="#D3D3D3"' : ''), |
|
79 |
- $files{'en'}->{$file}->{'rev'}, |
|
80 |
- ($obs ? ' (obsolete)' :''), |
|
81 |
- ($dir eq '.' ? '' : $dir.'/'), |
|
82 |
- $file, |
|
83 |
- $validatorlink; |
|
84 |
- |
|
85 |
- ${$_[0]}{$priority}->{$path}->{'data'} = $cell_path . $cell_en; |
|
86 |
- # Assign high urgency if it's *.wmi, else init to 0 |
|
87 |
- if ($file =~ /.wmi$/) { |
|
88 |
- ${$_[0]}{$priority}->{$path}->{'urgency'} = 1000; |
|
89 |
- } else { |
|
90 |
- ${$_[0]}{$priority}->{$path}->{'urgency'} = 0; |
|
91 |
- } |
|
92 |
- |
|
93 |
- for my $lang (@LANGUAGES) { |
|
94 |
- next if $lang eq 'en'; |
|
95 |
- my $color; |
|
96 |
- my $status; |
|
97 |
- #my $path = ($dir eq '.' ? '' : $dir.'/') . $file; |
|
98 |
- if ($validatorlink) { |
|
99 |
- $validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.%s">validator</a>', |
|
100 |
- $HTMLBASE, $htmlfile, $lang; |
|
101 |
- }; |
|
102 |
- if (exists $files{$lang}->{$file}) { |
|
103 |
- my $all_info = ''; |
|
104 |
- for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) { |
|
105 |
- next if $key eq 'Translation-Priority'; |
|
106 |
- $all_info .= sprintf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key}; |
|
107 |
- }; |
|
108 |
- |
|
109 |
- my $difflink; |
|
110 |
- if ($files{$lang}->{$file}->{'based'} eq $files{'en'}->{$file}->{'rev'}) { |
|
111 |
- $color='#90EE90'; |
|
112 |
- $status='current'; |
|
113 |
- $difflink=''; |
|
114 |
- } else { |
|
115 |
- $status='not current'; |
|
116 |
- if ($files{$lang}->{$file}->{'based'} ne 'unknown') { |
|
117 |
- $difflink=sprintf '<br><a href="https://svn.torproject.org/cgi-bin/viewvc.cgi/website/trunk/%sen/%s?root=Tor&r1=%s&r2=%s">changes in original</a>', |
|
118 |
- ($dir eq '.' ? '' : $dir.'/'), $file, $files{$lang}->{$file}->{'based'}, $files{'en'}->{$file}->{'rev'}; |
|
119 |
- $color='yellow'; |
|
120 |
- } else { |
|
121 |
- $difflink=''; |
|
122 |
- $color='#FFA500'; |
|
123 |
- }; |
|
124 |
- |
|
125 |
- ${$_[0]}{$priority}->{$path}->{'urgency'} += 1; |
|
126 |
- }; |
|
127 |
- |
|
128 |
- ${$_[0]}{$priority}->{$path}->{'data'} .= sprintf '<td bgcolor="%s">%s<br> |
|
129 |
- <a href="https://svn.torproject.org/cgi-bin/viewvc.cgi/website/trunk/%s%s/%s?root=Tor&view=markup">HEAD</a><br> |
|
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 { |
|
141 |
- #my $path = ($dir eq '.' ? '' : $dir.'/') . $file; |
|
142 |
- $color=(($obs or $priority eq 'none') ? |
|
143 |
- '#90EE90' : 'red'); |
|
144 |
- $status='missing'; |
|
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; |
|
148 |
- }; |
|
149 |
- delete $files{$lang}->{$file}; |
|
150 |
- }; |
|
151 |
- |
|
152 |
- ${$_[0]}{$priority}->{$path}->{'data'} .= $cell_en . $cell_path; |
|
153 |
- }; |
|
154 |
- }; |
|
155 |
- |
|
156 |
- for my $lang (@LANGUAGES) { |
|
157 |
- next if $lang eq 'en'; |
|
158 |
- if (keys %{$files{$lang}} > 0) { |
|
159 |
-# print "<p>"; |
|
160 |
- print "<br><br>"; |
|
161 |
- printf "<h2>Additional files in %s (%s)</h2>\n", $lang, $LANGUAGES{$lang}; |
|
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>"; |
|
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>"; |
|
175 |
- delete $files{$lang}->{$file}; |
|
176 |
- print "</tr>\n"; |
|
177 |
- }; |
|
178 |
- print "</table>\n\n"; |
|
179 |
- }; |
|
180 |
- }; |
|
181 |
-}; |
|
182 |
- |
|
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"; |
|
192 |
- printf("<th>%s (%s)</th>\n", $_, $LANGUAGES{$_}) for ('en', grep({ $_ ne 'en' } @LANGUAGES), 'en'); |
|
193 |
- print "<th>File</th>\n"; |
|
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); |
|
212 |
-do_status(%table_rows, 'torbutton', 1); |
|
213 |
-do_status(%table_rows, 'tordnsel', 1); |
|
214 |
-do_status(%table_rows, 'projects', 1); |
|
215 |
-do_status(%table_rows, 'torvm', 1); |
|
216 |
-do_status(%table_rows, 'press', 1); |
|
217 |
-#do_status(%table_rows, 'gettor', 1); |
|
218 |
-do_status(%table_rows, 'vidalia', 1); |
|
219 |
-#do_status(%table_data, 'eff', 1); |
|
220 |
-#do_status(%table_data, 'gui', 1); |
|
221 |
-sort_and_print(%table_rows); |
|
222 |
- |
|
223 |
- |
|
224 |
-:> |
|
225 |
- |
|
226 |
-</div><!-- #main --> |
|
227 |
- |
|
228 |
-#include <foot.wmi> |
|
229 | 0 |