tie my %src2bin, 'DB_File', "$DBDIR/sources_packages.db",
O_RDONLY, 0666, $DB_BTREE
or die "couldn't open $DBDIR/sources_packages.db: $!";
+tie my %desctrans, 'DB_File', "$DBDIR/descriptions_translated.db",
+ O_RDONLY, 0666, $DB_BTREE
+ or die "couldn't tie DB $DBDIR/descriptions_translated.db: $!";
my $sections = retrieve "$DBDIR/sections.info";
my $subsections = retrieve "$DBDIR/subsections.info";
my ($virt, $p_data) = split /\000/o, $data, 2;
%virt = split /\01/o, $virt;
foreach (split /\000/o, $p_data||'') {
- my @data = split ( /\s/o, $_, 8 );
+ my @data = split ( /\s/o, $_, 9 );
$pkg{$data[1]} ||= new Packages::Page( $pkg );
$pkg{$data[1]}->merge_package( { package => $pkg,
archive => $data[0],
subsection => $data[4],
priority => $data[5],
version => $data[6],
- description => $data[7] } );
+ 'description-md5' => $data[7],
+ description => $data[8] } );
}
foreach (keys %virt) {
next if $_ eq '-';
$p{section} = $entry->get_newest( 'section' );
$p{archive} = $entry->get_newest( 'archive' );
$p{desc} = $entry->get_newest( 'description' );
+ my $desc_md5 = $entry->get_newest( 'description-md5' );
+ my $trans_desc = $desctrans{$desc_md5};
+ if ($trans_desc) {
+ my %sdescs;
+ my %trans_desc = split /\000|\001/, $trans_desc;
+ while (my ($l, $d) = each %trans_desc) {
+ $d =~ s/\n.*//os;
+
+ $sdescs{$l} = $d;
+ }
+ $p{trans_desc} = \%sdescs;
+ }
$p{priority} = $entry->get_newest( 'priority' );
}
push @{$allpkgs{$key}}, \%p;
[% PROCESS marker text=section IF section != main_section %]
[% PROCESS marker text=archive IF archive != main_archive %]
[% END %]
+ [%- IF trans_desc.$lang;
+ sdesc = trans_desc.$lang;
+ ELSE;
+ sdesc = desc;
+ END -%]
[% IF providers.size %]
<dt><a href="[% name %]" id="[% name %]">[% name %]</a></dt>
<dd>[% g('virtual package provided by') %]
[%- ', ' UNLESS loop.last %][% END %]</dd>
[% IF versions.length %]
<dt><a href="[% name %]">[% name %]</a> ([% versions %])[% PROCESS markers %]</dt>
- <dd>[% desc | html %]</dd>
+ <dd>[% sdesc | html %]</dd>
[% END %]
[% ELSE %]
<dt><a href="[% name %]" id="[% name %]">[% name %]</a> ([% versions %])[% PROCESS markers %]</dt>
- <dd>[% desc | html %]</dd>
+ <dd>[% sdesc | html %]</dd>
[% END %]
[% '</dl>' IF loop.last %]