On Wed, Dec 26, 2001 at 11:47:32AM +0100, Josip Rodin wrote:
> > 2.) I put a _test_ page of packages.debian.org with support of
> >     translated package description on 
> >       http://ddtp.debian.org/packages.debian.org
> >     can we add something like that on packages.debian.org?
> > 
> >     (On the real page we shouldn't add a own form per language. We
> >     should add a new 'Language' tag on the form. For this we must change
> >     the cgi and add a new option 'lang=XX_XX', but I don't know phyton.)
> 
> It can be done... though I'd prefer the automatic way, using content
> negotiation, like Tomohiro suggested.

please check this patch...

Gruss
Grisu
-- 
Michael Bramer  -  a Debian Linux Developer      http://www.debsupport.de
PGP: finger [EMAIL PROTECTED]  -- Linux Sysadmin   -- Use Debian Linux
".... Zudem solltest Du die Vorhänge zuziehen, damit niemand
 einbricht." --- von Bodo Eggert in dasr im Thema P-FW
diff -ru orig/htmlscripts/create_package_pages.pl 
new/htmlscripts/create_package_pages.pl
--- orig/htmlscripts/create_package_pages.pl    Wed Dec 26 14:29:04 2001
+++ new/htmlscripts/create_package_pages.pl     Wed Dec 26 14:17:18 2001
@@ -43,6 +43,7 @@
        "html_root|h=s" => \$html_root,
        "md5file|m=s" => \$md5file,
        "experimental|e!" => \$experimental,
+       "lang|l!" => \$lang,
             );
 
 Getopt::Long::config('no_getopt_compat', 'no_auto_abbrev');
@@ -65,6 +66,7 @@
        exit;
 }
 $experimental = 0 unless defined $experimental;
+$lang = "en" unless defined $lang;
 
 if ($#ARGV >= 0) {
        @packages_files = @ARGV;
@@ -93,7 +95,7 @@
 
 create_package_dependencies();
 
-write_pages($html_root);
+write_pages($html_root,$lang);
 
 
 
diff -ru orig/htmlscripts/pages.pl new/htmlscripts/pages.pl
--- orig/htmlscripts/pages.pl   Wed Dec 26 14:29:07 2001
+++ new/htmlscripts/pages.pl    Wed Dec 26 14:23:43 2001
@@ -16,26 +16,26 @@
 $BUG_URL = 'http://bugs.debian.org/';
 
 sub write_pages() {
-       my ($dest_dir) = @_;
+       my ($dest_dir,$lang) = @_;
        my $res;
 
        @tmp = split('/', $dest_dir);
        $release = pop(@tmp);
        read_md5_hash();
        create_sections();
-       write_main_index($dest_dir);
-       write_all_package($dest_dir);
+       write_main_index($dest_dir,$lang);
+       write_all_package($dest_dir,$lang);
        foreach(sort(keys %sections)) {
 #              print "$sections{$_}[1]\n";
                if ($sections{$_}[2]) {
-                       write_section($dest_dir, $_);
+                       write_section($dest_dir, $_,$lang);
                }
        }
        write_md5_hash();
 }
 
 sub write_main_index() {
-       my ($dest_dir) = @_;
+       my ($dest_dir,$lang) = @_;
        use POSIX;
        my $res;
 
@@ -70,9 +70,9 @@
        $index_page .= "</dl></table>\n";
        $index_page .= "<center><a href=allpackages.html title=\"List of all 
packages\">All packages</a>\n";
        $index_page .= trailer('../..');
-       if(file_changed("$dest_dir/index.html", $index_page)) {
-               open(FILEH, ">$dest_dir/index.html") || die "Can\'t open file 
$dest_dir/index.html: $!";
-               sysopen(FILEH, "$dest_dir/index.html", O_WRONLY | O_TRUNC | 
O_CREAT, 0664) || die "Can\'t open file $dest_dir/index.html: $!";
+       if(file_changed("$dest_dir/index.$lang.html", $index_page)) {
+               open(FILEH, ">$dest_dir/index.$lang.html") || die "Can\'t open 
file $dest_dir/index.$lang.html: $!";
+               sysopen(FILEH, "$dest_dir/index.$lang.html", O_WRONLY | O_TRUNC 
| O_CREAT, 0664) || die "Can\'t open file $dest_dir/index.$lang.html: $!";
                $now_time = gmtime();
                $index_page =~ s/LAST_MODIFIED_DATE/$now_time/;
                print FILEH $index_page;
@@ -81,7 +81,7 @@
 }
 
 sub write_all_package() {
-       my ($dest_dir) = @_;
+       my ($dest_dir,$lang) = @_;
        my $res;
 
        @htmldir = split /\//, $dest_dir; $distro = pop @htmldir;
@@ -99,9 +99,9 @@
        }
        $all_package .= "</dl>\n";
        $all_package .= trailer('../..');
-       if(file_changed("$dest_dir/allpackages.html", $all_package)) {
-               open(FILEH, ">$dest_dir/allpackages.html") || die "Can\'t open 
file $dest_dir/allpackages.html: $!";
-               sysopen(FILEH, "$dest_dir/allpackages.html", O_WRONLY | O_TRUNC 
| O_CREAT, 0664) || die "Can\'t open file $dest_dir/allpackages.html: $!";
+       if(file_changed("$dest_dir/allpackages.$lang.html", $all_package)) {
+               open(FILEH, ">$dest_dir/allpackages.$lang.html") || die "Can\'t 
open file $dest_dir/allpackages.$lang.html: $!";
+               sysopen(FILEH, "$dest_dir/allpackages.$lang.html", O_WRONLY | 
O_TRUNC | O_CREAT, 0664) || die "Can\'t open file 
$dest_dir/allpackages.$lang.html: $!";
                $now_time = gmtime();
                $all_package =~ s/LAST_MODIFIED_DATE/$now_time/;
                print FILEH $all_package;
@@ -110,7 +110,7 @@
 }
 
 sub write_section() {
-       my ($dest_dir, $section) = @_;
+       my ($dest_dir, $section, $lang) = @_;
        my $res;
 
        $now_time = gmtime();
@@ -235,9 +235,9 @@
 
                $package_page .= trailer('../../..');
 
-               if (file_changed("$dest_dir/$section/$pack.html", 
$package_page)) {
-                       open(FILEH_PACK, ">$dest_dir/$section/$pack.html") || 
die "Can\'t open file $dest_dir/$section/$pack.html: $!";
-                       sysopen(FILEH_PACK, "$dest_dir/$section/$pack.html", 
O_WRONLY | O_TRUNC | O_CREAT, 0664) || die "Can\'t open file 
$dest_dir/$section/$pack.html: $!";
+               if (file_changed("$dest_dir/$section/$pack.$lang.html", 
$package_page)) {
+                       open(FILEH_PACK, 
">$dest_dir/$section/$pack.$lang.html") || die "Can\'t open file 
$dest_dir/$section/$pack.$lang.html: $!";
+                       sysopen(FILEH_PACK, 
"$dest_dir/$section/$pack.$lang.html", O_WRONLY | O_TRUNC | O_CREAT, 0664) || 
die "Can\'t open file $dest_dir/$section/$pack.$lang.html: $!";
                        $package_page =~ s/LAST_MODIFIED_DATE/$now_time/;
                        print FILEH_PACK $package_page;
                        close FILEH_PACK;
@@ -245,10 +245,10 @@
        }
        $section_page .= "</dl>\n\n";
        $section_page .= trailer('../../..');
-       if(file_changed("$dest_dir/$section/index.html", $section_page)) {
-               open(FILEH_SEC, ">$dest_dir/$section/index.html") or
-                      print "Couldn't open index.html in section $section\n";
-               sysopen(FILEH_SEC, "$dest_dir/$section/index.html", O_WRONLY | 
O_TRUNC | O_CREAT, 0664) || die "Can\'t open file 
$dest_dir/$section/index.html: $!";
+       if(file_changed("$dest_dir/$section/index.$lang.html", $section_page)) {
+               open(FILEH_SEC, ">$dest_dir/$section/index.$lang.html") or
+                      print "Couldn't open index.$lang.html in section 
$section\n";
+               sysopen(FILEH_SEC, "$dest_dir/$section/index.$lang.html", 
O_WRONLY | O_TRUNC | O_CREAT, 0664) || die "Can\'t open file 
$dest_dir/$section/index.$lang.html: $!";
                $section_page =~ s/LAST_MODIFIED_DATE/$now_time/;
                print FILEH_SEC $section_page;
                close FILEH_SEC;
diff -ru orig/update-files new/update-files
--- orig/update-files   Wed Dec 26 14:34:55 2001
+++ new/update-files    Wed Dec 26 14:40:10 2001
@@ -38,3 +38,19 @@
 #      gunzip -c Sources.gz > experimental/${sect}.Sources.non-US; } || true
 done
 rm -f Packages.gz Sources.gz
+
+for lang in ${ddtp_langs}; do
+  test -d ${lang} || mkdir -p ${lang}
+  for dist in unstable testing ${frozen} stable; do
+    test -d ${lang}/${dist} || mkdir -p ${lang}/${dist}
+    echo "getting Packages/Sources from ${lang}/${dist}"
+    for sect in main ; do
+      { wget -q -N 
$ddtp_ftpsite/dists/${lang}/${dist}/${sect}/binary-i386/Packages.gz && \
+        gunzip -c Packages.gz > ${lang}/${dist}/${sect}.Packages; } || true
+      { wget -q -N $ddtp_ftpsite/dists/${dist}/${sect}/source/Sources.gz && \
+        gunzip -c Sources.gz > ${lang}/${dist}/${sect}.Sources; } || true
+    done
+    rm -f Packages.gz Sources.gz
+  done
+done 
+
diff -ru orig/update-htmls new/update-htmls
--- orig/update-htmls   Wed Dec 26 14:30:09 2001
+++ new/update-htmls    Wed Dec 26 14:41:33 2001
@@ -38,3 +38,37 @@
     $filesdir/${dist}/{main,contrib,non-free}.{Packages,Sources}
   fi
 done
+
+for lang in ${ddtp_langs}; do
+  for dist in unstable testing ${frozen} stable; do
+    test -d ${htmldir}/${lang}/${dist} || mkdir -p ${htmldir}/${lang}/${dist}
+    echo "updating Packages/${lang}/${dist}"
+  
+    # weekly cleanup <sigh>
+    # if [ $hour -ge 18 -a $dow -eq 0 ] ; then
+    if [ $dow -eq 0 ] ; then
+      rm -rf $htmldir/${lang}/${dist}/*
+    fi
+  
+    # the below two URLs are *different* from $ftpsite and $nonus_ftpsite
+    if [ $dist != "experimental" ]; then
+      $script_base/create_package_pages.pl \
+      -s http://ftp.debian.org/debian \
+      -n http://non-us.debian.org/debian-non-US \
+      -h $htmldir/${lang}/${dist} \
+      -m $filesdir/md5sum.${lang}.${dist} \
+      -l $lang \
+      $filesdir/${lang}/${dist}/main.{Packages,Sources}
+    else
+      $script_base/create_package_pages.pl \
+      -s http://ftp.debian.org/debian \
+      -n http://non-us.debian.org/debian-non-US \
+      -h $htmldir/${lang}/${dist} \
+      -m $filesdir/md5sum.${lang}.${dist} \
+      -l $lang \
+      -e \
+      $filesdir/${lang}/${dist}/main.{Packages,Sources}
+    fi
+  done
+done
+
diff -ru orig/vars new/vars
--- orig/vars   Wed Dec 26 14:42:19 2001
+++ new/vars    Wed Dec 26 14:42:59 2001
@@ -10,3 +10,6 @@
 htmldir=$topdir/www
 ftpsite=http://ftp.debian.org/debian
 nonus_ftpsite=http://ftp.uk.debian.org/debian/non-US
+ddtp_ftpsite=http://ddtp.debian.org/aptable
+ddtp_langs="fr ja de pt_BR"
+

Attachment: pgpCWI8rrX5cc.pgp
Description: PGP signature

Reply via email to