]> git.deb.at Git - deb/packages.git/commitdiff
Use the web names for languages instead of locale names
authorFrank Lichtenheld <frank@lichtenheld.de>
Sun, 25 Nov 2007 11:52:26 +0000 (12:52 +0100)
committerFrank Lichtenheld <frank@lichtenheld.de>
Sun, 25 Nov 2007 12:07:38 +0000 (13:07 +0100)
i.e. pt-br instead of pt_BR. This is how they are sent by the browsers.
Since the DDTP uses the locale names, we need to transform between the
two forms in synctrans and parse-translations.

bin/parse-translations
config.sh.sed.in
cron.d/120synctrans

index 095820421b1871347712295016b770f1b561434a..314602499f4fdbb866824054c1cb49102065fe00 100755 (executable)
@@ -46,8 +46,9 @@ $/ = "";
 my $fixja = Text::Iconv->new("EUC-JP", "UTF-8");
 
 foreach my $lang (@DDTP_LANGUAGES) {
 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, "zcat $TOPDIR/archive/*/*/*/i18n/Translation-$locale.gz|";
     my $count = 0;
     while (<PKG>) {
        next if /^\s*$/;
     my $count = 0;
     while (<PKG>) {
        next if /^\s*$/;
@@ -64,12 +65,13 @@ foreach my $lang (@DDTP_LANGUAGES) {
        # Skip double descriptions
        next if exists($descriptions{$data{"description-md5"}}{$lang});
        # some weirdnesses in the files
        # 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;
        }
        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";
        $count++;
     }
     print "($count)\n";
index bea71b8dbc2264c52a102e7d46618c7bec9b1aea..6c2bf7c62cb56764b9c76e42f4d8888b4b7954f7 100644 (file)
@@ -37,7 +37,7 @@ root=""
 # Architectures
 #
 polangs="de fi fr hu ja nl sv uk"
 # Architectures
 #
 polangs="de fi fr hu ja nl sv uk"
-ddtplangs="ca cs da de eo es fi fr go hu it ja km_KH ko nl pl pt pt_BR ru sk sv uk zh zh_CN zh_TW"
+ddtplangs="ca cs da de eo es fi fr go hu it ja km-kh ko nl pl pt pt-br ru sk sv uk zh zh-cn zh-tw"
 archives="us security amd64 gnuab backports volatile"
 sections="main contrib non-free"
 parts="$sections"
 archives="us security amd64 gnuab backports volatile"
 sections="main contrib non-free"
 parts="$sections"
index 115b59fa86c8ad8e9e63011e8e7e047a798adeb4..437aa921d9cdf0332ee99c8dc4a6eeba2c031a16 100755 (executable)
@@ -19,9 +19,10 @@ then
          test -d us/${dist}/${part}/i18n || mkdir -p us/${dist}/${part}/i18n
          for lang in $ddtplangs
          do
          test -d us/${dist}/${part}/i18n || mkdir -p us/${dist}/${part}/i18n
          for lang in $ddtplangs
          do
-           echo retrieve translated Descs $dist/$part/$lang
+           locale=$(echo $lang|perl -p -e 's/^([a-z]{2})-([a-z]{2})$/"$1_".uc($2)/e')
+           echo "retrieve translated Descs $dist/$part/$lang ($locale)"
             (cd us/${dist}/${part}/i18n &&
             (cd us/${dist}/${part}/i18n &&
-                wget -q -N ${ddtp_ftpsite}/dists/${dist}/${part}/i18n/Translation-$lang.gz)
+                wget -q -N ${ddtp_ftpsite}/dists/${dist}/${part}/i18n/Translation-$locale.gz)
          done
        done
     done
          done
        done
     done