]> git.deb.at Git - deb/packages.git/blobdiff - bin/parse-translations
ddtp: for a description-md5, use most recent translation (Closes: #621476)
[deb/packages.git] / bin / parse-translations
index 095820421b1871347712295016b770f1b561434a..d079b7f99634425aa548b45a71afcae65d34d34e 100755 (executable)
@@ -45,10 +45,17 @@ $/ = "";
 
 my $fixja = Text::Iconv->new("EUC-JP", "UTF-8");
 
+# FIXME: one database per dist
+# http://lists.debian.org/4E42E104.90201@deb-support.de
+# FIXME: unhardcode dists name
+my @dists = ('sid', 'wheezy', 'squeeze', 'lenny');
+
 foreach my $lang (@DDTP_LANGUAGES) {
-    print "Reading Translations for $lang...";
-    open PKG, "zcat $TOPDIR/archive/*/*/*/i18n/Translation-$lang.gz|";
+    (my $locale = $lang) =~ s/^([a-z]{2})-([a-z]{2})$/"$1_".uc($2)/e;
+    print "Reading Translations for $lang ($locale)...";
     my $count = 0;
+    foreach my $dist (@dists) {
+    open PKG, "bzcat $TOPDIR/archive/*/$dist/*/i18n/Translation-$locale.bz2|";
     while (<PKG>) {
        next if /^\s*$/;
        my $data = "";
@@ -64,14 +71,16 @@ foreach my $lang (@DDTP_LANGUAGES) {
        # Skip double descriptions
        next if exists($descriptions{$data{"description-md5"}}{$lang});
        # some weirdnesses in the files
-       next unless defined $data{"description-".lc($lang)};
+       next unless defined $data{"description-".lc($locale)};
        if ($lang eq 'ja') {
            my $fixed = $fixja->convert($data{"description-ja"});
            $data{"description-ja"} = $fixed if $fixed;
        }
-       $descriptions{$data{"description-md5"}}{$lang} = $data{"description-".lc($lang)};
+       $descriptions{$data{"description-md5"}}{$lang} =
+           $data{"description-".lc($locale)};
        $count++;
     }
+    }
     print "($count)\n";
 }
 close PKG;