use Deb::Versions;
use Packages::Config qw( $DBDIR @SUITES @ARCHIVES @SECTIONS
- @ARCHITECTURES %FTP_SITES );
+ @ARCHITECTURES %FTP_SITES @DDTP_LANGUAGES);
use Packages::I18N::Locale;
use Packages::CGI qw( :DEFAULT make_url make_search_url note );
use Packages::DB;
debug( "Data search and merging took ".timestr($std) ) if DEBUG;
my $did = $page->get_newest( 'description' );
+ my $desc_md5 = $page->get_newest( 'description-md5' );
my @complete_tags = split(/, /, $page->get_newest( 'tag' ));
my @tags;
foreach (@complete_tags) {
# process description
#
+ sub process_description {
+ my ($desc) = @_;
+
+ my $short_desc = encode_entities( $1, "<>&\"" )
+ if $desc =~ s/^(.*)$//m;
+ my $long_desc = encode_entities( $desc, "<>&\"" );
+
+ $long_desc =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),<a href=\"$1\">$1</a>$3,go; # syntax highlighting -> '];
+ $long_desc =~ s/\A //o;
+ $long_desc =~ s/\n /\n/sgo;
+ $long_desc =~ s/\n.\n/\n<p>\n/go;
+ $long_desc =~ s/(((\n|\A) [^\n]*)+)/\n<pre>$1\n<\/pre>/sgo;
+
+ return ($short_desc, $long_desc);
+ }
+
my $desc = $descriptions{$did};
- $short_desc = encode_entities( $1, "<>&\"" )
- if $desc =~ s/^(.*)$//m;
- my $long_desc = encode_entities( $desc, "<>&\"" );
-
- $long_desc =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),<a href=\"$1\">$1</a>$3,go; # syntax highlighting -> '];
- $long_desc =~ s/\A //o;
- $long_desc =~ s/\n /\n/sgo;
- $long_desc =~ s/\n.\n/\n<p>\n/go;
- $long_desc =~ s/(((\n|\A) [^\n]*)+)/\n<pre>$1\n<\/pre>/sgo;
-
- $contents{desc} = { short => $short_desc,
- long => $long_desc, };
+ my $long_desc;
+ ($short_desc, $long_desc) = process_description($desc);
+
+ $contents{desc}{en} = { short => $short_desc,
+ long => $long_desc, };
+
+ debug( "desc_md5=$desc_md5", 2)
+ if DEBUG;
+ my $trans_desc = $desctrans{$desc_md5};
+ if ($trans_desc) {
+ my %trans_desc = split /\000|\001/, $trans_desc;
+ debug( "TRANSLATIONS: ".join(" ",keys %trans_desc), 2)
+ if DEBUG;
+ while (my ($l, $d) = each %trans_desc) {
+ my ($short_t, $long_t) = process_description($d);
+
+ $contents{desc}{$l} = { short => $short_t,
+ long => $long_t, };
+ }
+ }
my $v_str = $version;
my $multiple_versions = grep { $_ ne $version } values %$versions;
nav_arr.push( { title => 'Source packages', url=>make_url('/'), name=>'Source' } ) IF is_source;
nav_arr.push( { prefix=>'Section:', title=>'All packages in this section', url=>make_url("$subsection/"), name=>subsection } );
nav_arr.push( { prefix=>'Package:', name=>pkg } ); -%]
+[% desclang = 'en';
+ SET desclang = lang IF desc.$lang.long %]
[%- PROCESS 'html/head.tmpl'
title_tag = ( is_source ? "Details of source package $pkg in $suite"
: "Details of package $pkg in $suite" )
- description = desc
+ description = desc.$desclang.short
keywords = "$suite, $archive, $section, $subsection, $version"
print_search_field = 'packages'
search_field_values = {
<div id="pdesctab">
<div id="pdesc">
[% UNLESS is_virtual %]
- [% IF desc.short %]
- <h2>[% desc.short %]</h2>
- <p>[% desc.long %]
+ [% IF desc.$desclang.short %]
+ <h2>[% desc.$desclang.short %]</h2>
+ <p>[% desc.$desclang.long %]
[% END %]
[% ELSE %]
<p>This is a <em>virtual package</em>. See the <a href="[% policy_url %]">Debian policy</a> for a <a href="[% policy_url %]ch-binary.html#s-virtual_pkg">definition of virtual packages</a>.</p>