X-Git-Url: https://git.deb.at/?p=deb%2Fpackages.git;a=blobdiff_plain;f=bin%2Fparse-translations;h=21bcaaa3969ae5a793d85ae32b74a649024ae4be;hp=fa9855db14ca200bf38466ceeb6fde23188e706e;hb=0f318fa9ad9d473b543a48f46a7714a11283d300;hpb=0d8eec4fee0812400e3b65560f4df8eca9e1a448 diff --git a/bin/parse-translations b/bin/parse-translations index fa9855d..21bcaaa 100755 --- a/bin/parse-translations +++ b/bin/parse-translations @@ -2,9 +2,8 @@ # Convert Translation.gz files into Sleepycat db files for efficient usage of # data # -# $Id$ -# # Copyright (C) 2006 Jeroen van Wolffelaar +# Copyright (C) 2007 Frank Lichtenheld # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -17,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; @@ -47,8 +46,9 @@ $/ = ""; my $fixja = Text::Iconv->new("EUC-JP", "UTF-8"); 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)..."; + open PKG, "bzcat $TOPDIR/archive/*/*/*/i18n/Translation-$locale.bz2|"; my $count = 0; while () { next if /^\s*$/; @@ -65,12 +65,13 @@ 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";