[Debian-l10n-commits] r2723 - in /ddtp-web: Changelog file2Translation_udd.pl update0.5.sh
nekral-guest at users.alioth.debian.org
nekral-guest at users.alioth.debian.org
Tue Jul 26 19:57:39 UTC 2011
Author: nekral-guest
Date: Tue Jul 26 19:57:38 2011
New Revision: 2723
URL: http://svn.debian.org/wsvn/?sc=1&rev=2723
Log:
* file2Translation_udd.pl: Added as it is currently on churro.
* update0.5.sh: The UDD Tranlation files are updated here in
churro.
Added:
ddtp-web/file2Translation_udd.pl (with props)
Modified:
ddtp-web/Changelog
ddtp-web/update0.5.sh
Modified: ddtp-web/Changelog
URL: http://svn.debian.org/wsvn/ddtp-web/Changelog?rev=2723&op=diff
==============================================================================
--- ddtp-web/Changelog (original)
+++ ddtp-web/Changelog Tue Jul 26 19:57:38 2011
@@ -1,3 +1,9 @@
+2011-07-26 Nicolas Francois <nicolas.francois at centraliens.net>
+
+ * file2Translation_udd.pl: Added as it is currently on churro.
+ * update0.5.sh: The UDD Tranlation files are updated here in
+ churro.
+
2011-07-26 Nicolas Francois <nicolas.francois at centraliens.net>
* Packages2packages_tb.sh: Fix typo. Download of Packages from
Added: ddtp-web/file2Translation_udd.pl
URL: http://svn.debian.org/wsvn/ddtp-web/file2Translation_udd.pl?rev=2723&op=file
==============================================================================
--- ddtp-web/file2Translation_udd.pl (added)
+++ ddtp-web/file2Translation_udd.pl Tue Jul 26 19:57:38 2011
@@ -1,0 +1,92 @@
+#!/usr/bin/perl
+
+use diagnostics;
+use strict;
+
+my $dists= shift(@ARGV);
+my $lang= shift(@ARGV);
+
+use DBI;
+use Digest::MD5 qw(md5_hex);
+
+my @DSN = ("DBI:Pg:dbname=ddtp", "", "");
+
+my $dbh = DBI->connect(@DSN,
+ { PrintError => 0,
+ RaiseError => 1,
+ AutoCommit => 0,
+ });
+
+die $DBI::errstr unless $dbh;
+
+
+my $package;
+
+sub get_translation {
+ my $description_id= shift(@_);
+ my $lang= shift(@_);
+
+ my $translation;
+
+ my $sth = $dbh->prepare("SELECT translation FROM translation_tb WHERE description_id=? and language=?");
+ $sth->execute($description_id,$lang);
+ ($translation) = $sth->fetchrow_array;
+ if ($translation and (( $translation =~ tr/\n/\n/ )<2)) {
+ undef $translation;
+ }
+ return $translation;
+}
+
+sub get_packageinfos {
+ my $description_id= shift(@_);
+
+ my $description_md5;
+
+ my $sth = $dbh->prepare("SELECT description_md5 FROM description_tb WHERE description_id=?");
+ $sth->execute($description_id);
+ ($description_md5) = $sth->fetchrow_array;
+ return ($description_md5);
+}
+
+sub make_translation_file {
+ my $tag= shift(@_);
+
+ my %seen_package_and_description_ids;
+ my $package;
+ my $version;
+ my $translation;
+ my $description_md5;
+ my $description_id;
+
+ open (PACKAGELIST, "<Packages/packagelist-$tag");
+ while (<PACKAGELIST>) {
+ chomp;
+ ($package,$version) = split (/ /);
+ #print "^$package^$version^";
+ my $sth = $dbh->prepare("SELECT description_id FROM description_tb WHERE description_id in (SELECT description_id FROM package_version_tb WHERE package=? and version=?)");
+ $sth->execute($package,$version);
+ while(($description_id) = $sth->fetchrow_array) {
+ #print " -> $description_id\n";
+ unless ($seen_package_and_description_ids{"$package $description_id"}) {
+ $translation=get_translation($description_id,$lang);
+ if ($translation) {
+ ($description_md5)=get_packageinfos($description_id);
+ print "Package: $package\n";
+ print "Version: $version\n";
+ print "Description-md5: $description_md5\n";
+ print "Description-$lang: $translation\n";
+ }
+ $seen_package_and_description_ids{"$package $description_id"}=1;
+ }
+ }
+ }
+ close (PACKAGELIST);
+
+ # # get only the uniq elements (see man perlfaq5)
+ # my %hash = map { $_, 1 } @description_ids;
+ # my @unique = keys %hash;
+
+ # return @unique;
+}
+
+make_translation_file($dists);
Propchange: ddtp-web/file2Translation_udd.pl
------------------------------------------------------------------------------
svn:executable = *
Modified: ddtp-web/update0.5.sh
URL: http://svn.debian.org/wsvn/ddtp-web/update0.5.sh?rev=2723&op=diff
==============================================================================
--- ddtp-web/update0.5.sh (original)
+++ ddtp-web/update0.5.sh Tue Jul 26 19:57:38 2011
@@ -7,6 +7,7 @@
./db2web.sh
# ./db2Translation.sh
./file2Translation.sh
+./file2Translation_udd.sh
# Regenerate the stats files
/home/kleptog/stats/ddts-stats sid >/dev/null
More information about the Debian-l10n-commits
mailing list