git.schokokeks.org
Repositories
Help
Report an Issue
tor-webwml.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
aa4ebe5e8
Branches
Tags
bridges
docs-debian
jobs
master
press-clips
tor-webwml.git
en
translation-status.wml
Apply patch from black penguin to fix perl errors in translation-status
Andrew Lewman
commited
aa4ebe5e8
at 2009-06-10 03:57:52
translation-status.wml
Blame
History
Raw
## translation metadata # Revision: $Revision$ # Note to translators: # translating this page is probably not a good idea, and it never was intended to be translated. # it contains lots of programming logic, which you would have to duplicate, and it's probably # useful only to other translators which most likely will know a bit of english. # # Thanks for your hard work, improve the other pages instead. :) -- weasel #include "head.wmi" TITLE="Tor: Translation status" CHARSET="UTF-8" #use "functions.wmi" <div class="main-column"> <h2>Tor: Translation status</h2> <hr /> <: sub do_status(\%$$) { my $dir = $_[1]; my $may_miss_dir = $_[2]; my %files; my @warnings; for my $lang (@LANGUAGES) { my $dir_opened = opendir(DIR, "$dir/$lang"); if (! $dir_opened) { $may_miss_dir or die ("Cannot opendir $dir/$lang: $!\n"); next; } my @files = grep { $_ ne '.' && $_ ne '..' && $_ !~ /tor-manual/i && $_ !~ /translation-status/i && $_ =~ m/^[^.]/ && -f "$dir/$lang/$_"} readdir(DIR); closedir DIR; for my $file (@files) { $files{$lang}->{$file}->{'all'} = getMetadata("$dir/$lang/$file"); if ($lang eq 'en') { $files{$lang}->{$file}->{'rev'} = translation_get_masterrevision_file($dir, $file); } else { $files{$lang}->{$file}->{'based'} = translation_get_basedonrevision_langfile($dir, $lang, $file); }; }; }; my %priorities; for my $file (keys %{$files{'en'}}) { my $p = $files{'en'}->{$file}->{'all'}->{'Translation-Priority'}; if (defined $p) { $priorities{$p} = 1; }; }; my @priorities = sort {$a cmp $b} keys %priorities; push @priorities, 'none'; my $HTMLBASE = (defined $ENV{'HTMLBASE'} ? $ENV{'HTMLBASE'} : 'https://www.torproject.org/') . ($dir eq '.' ? '' : $dir.'/'); for my $priority (@priorities) { for my $file (sort {$a cmp $b} keys %{$files{'en'}}) { my $file_priority = $files{'en'}->{$file}->{'all'}->{'Translation-Priority'}; next if (defined $file_priority && $priority ne $file_priority); next if (!defined $file_priority && $priority ne 'none'); my $path = ($dir eq '.' ? '' : $dir.'/') . $file; my $obs = file_is_obsolete($dir, 'en', $file); my $validatorlink = ''; my $htmlfile = $file; if ($htmlfile =~ s/\.wml/.html/) { $validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.en">validator</a>', $HTMLBASE, $htmlfile; }; my $cell_path = sprintf '<th>%s</th>', $path; my $cell_en = sprintf '<td%s>Revision %s%s<br> <a href="https://svn.torproject.org/cgi-bin/viewvc.cgi/website/trunk/%sen/%s?root=Tor&view=markup">HEAD</a> %s', ($obs ? ' bgcolor="#D3D3D3"' : ''), $files{'en'}->{$file}->{'rev'}, ($obs ? ' (obsolete)' :''), ($dir eq '.' ? '' : $dir.'/'), $file, $validatorlink; ${$_[0]}{$priority}->{$path}->{'data'} = $cell_path . $cell_en; # Assign high urgency if it's *.wmi, else init to 0 if ($file =~ /.wmi$/) { ${$_[0]}{$priority}->{$path}->{'urgency'} = 1000; } else { ${$_[0]}{$priority}->{$path}->{'urgency'} = 0; } for my $lang (@LANGUAGES) { next if $lang eq 'en'; my $color; my $status; #my $path = ($dir eq '.' ? '' : $dir.'/') . $file; if ($validatorlink) { $validatorlink = sprintf '<br><a href="http://validator.w3.org/check?uri=%s%s.%s">validator</a>', $HTMLBASE, $htmlfile, $lang; }; if (exists $files{$lang}->{$file}) { my $all_info = ''; for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) { next if $key eq 'Translation-Priority'; $all_info .= sprintf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key}; }; my $difflink; if ($files{$lang}->{$file}->{'based'} eq $files{'en'}->{$file}->{'rev'}) { $color='#90EE90'; $status='current'; $difflink=''; } else { $status='not current'; if ($files{$lang}->{$file}->{'based'} ne 'unknown') { $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>', ($dir eq '.' ? '' : $dir.'/'), $file, $files{$lang}->{$file}->{'based'}, $files{'en'}->{$file}->{'rev'}; $color='yellow'; } else { $difflink=''; $color='#FFA500'; }; ${$_[0]}{$priority}->{$path}->{'urgency'} += 1; }; ${$_[0]}{$priority}->{$path}->{'data'} .= sprintf '<td bgcolor="%s">%s<br> <a href="https://svn.torproject.org/cgi-bin/viewvc.cgi/website/trunk/%s%s/%s?root=Tor&view=markup">HEAD</a><br> %s %s %s</td>', $color, $status, ($dir eq '.' ? '' : $dir.'/'), $lang, $file, $all_info, $difflink, $validatorlink; } else { #my $path = ($dir eq '.' ? '' : $dir.'/') . $file; $color=(($obs or $priority eq 'none') ? '#90EE90' : 'red'); $status='missing'; ${$_[0]}{$priority}->{$path}->{'data'} .= sprintf '<td bgcolor="%s">%s</td>', $color, $status; ${$_[0]}{$priority}->{$path}->{'urgency'} += ($obs or $priority eq 'none') ? 0 : 2; }; delete $files{$lang}->{$file}; }; ${$_[0]}{$priority}->{$path}->{'data'} .= $cell_en . $cell_path; }; }; for my $lang (@LANGUAGES) { next if $lang eq 'en'; if (keys %{$files{$lang}} > 0) { # print "<p>"; print "<br><br>"; printf "<h2>Additional files in %s (%s)</h2>\n", $lang, $LANGUAGES{$lang}; print "<table border=1>\n"; print "<tr>\n"; print "<th>File</th>\n"; print "<th>Based on Revision</th>\n"; print "</tr>\n"; for my $file (sort {$a cmp $b} keys %{$files{$lang}}) { print "<tr>"; printf "<th>%s</th><td>", $file; for my $key (sort {$a cmp $b} keys %{$files{$lang}->{$file}->{'all'}}) { printf "%s: %s<br>", $key, $files{$lang}->{$file}->{'all'}->{$key}; }; printf "</td>"; delete $files{$lang}->{$file}; print "</tr>\n"; }; print "</table>\n\n"; }; }; }; sub sort_and_print(\%) { my %rows = %{$_[0]}; for my $priority (sort {$a cmp $b} keys %rows) { print "<h2>Translation priority: $priority</h2>\n"; print "<table border=1>\n"; print "<tr>\n"; print "<th>File</th>\n"; printf("<th>%s (%s)</th>\n", $_, $LANGUAGES{$_}) for ('en', grep({ $_ ne 'en' } @LANGUAGES), 'en'); print "<th>File</th>\n"; print "</tr>\n"; for my $row (sort {$rows{$priority}->{$b}->{'urgency'} <=> $rows{$priority}->{$a}->{'urgency'}} keys %{$rows{$priority}}) { print "<tr>"; print $rows{$priority}->{$row}->{'data'}; delete ${$_[0]}{$priority}->{$row}; print "</tr>\n\n"; }; print "</table><br>\n\n\n"; }; }; # accumulate the table rows, then sort and print them my %table_rows; do_status(%table_rows, '.', 0); do_status(%table_rows, 'docs', 1); do_status(%table_rows, 'torbrowser', 1); do_status(%table_rows, 'torbutton', 1); do_status(%table_rows, 'tordnsel', 1); do_status(%table_rows, 'projects', 1); do_status(%table_rows, 'torvm', 1); do_status(%table_rows, 'press', 1); do_status(%table_rows, 'gettor', 1); #do_status(%table_data, 'eff', 1); #do_status(%table_data, 'gui', 1); sort_and_print(%table_rows); :> </div><!-- #main --> #include <foot.wmi>