[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: minor breakage in international/l10n



On Sun, May 27, 2001 at 05:47:59PM +0200, Martin Quinson wrote:
> On Sat, May 26, 2001 at 02:49:46PM +0200, Martin Schulze wrote:
> > James A. Treacy wrote:
> > > A quick look did not show me where the following problems come from:
> > > 
> > > Looking into http://www.debian.org/international/l10n/l10n.en.html
> > >   http://www.debian.org/international/l10n/po-Pa : Error = (404) Not Found
> > >   [many more identical lines snipped]
> > > 
> > > Looking into http://www.debian.org/international/l10n/team-po.en.html
> > >   http://www.debian.org/international/l10n/po-Pa : Error = (404) Not Found
> > 
> > The problem seems to arise from international/l10n/data/unstable:
> > 
> > Package: python-4suite
> > Version: 0.10.2-1
> > Section: interpreters
> > Priority: optional
> > Type: ?
> > Upstream: other
> > Stats: en_US: 0t0f30u
> > Stats: de: 80t0f0u
> > Stats: Pa: 0t0f6u        <----------------- should be pa, I guess
> > Stats: fr_FR: 77t0f1u
> > PO:
> > 
> > Can somebody fix this?
> 
> Well, it's fixed in the data file, but I can't manage to fix it in the
> script generating the DB. The problem is in the following of your snipet:
> Stats: fr_FR: 77t0f1u
> PO:
> [...]
>  Ods/Parsers/Odl/en_US.po:pa:0t0f2u:Ods/Parsers/Odl/python-4suite_0.10.2-1_Ods_Parsers_Odl_en_US.po
>  Ods/Parsers/Oif/en_US.po:pa:0t0f2u:Ods/Parsers/Oif/python-4suite_0.10.2-1_Ods_Parsers_Oif_en_US.po
>  Ods/Parsers/Oql/en_US.po:pa:0t0f2u:Ods/Parsers/Oql/python-4suite_0.10.2-1_Ods_Parsers_Oql_en_US.po
> 
> So, my stupid script think that Ods/Parsers/Odl/en_US.po is in 'pa', and
> not in 'en_US' as it should.
> 
> The offending code is the following (from intl/l10n/scripts/transmonitor-check):
> 
>     ##
>     ## for po files, try to guess the language from the name, 
>     ##      and the l10n with msgfmt
>     ##
>     my $file; # the po file name in the package
>     my $filename; #the po file name to be archived
>     my $lang=""; # the identified code language
>     my $bad_lang=""; #this could be a language, but this is not a valid language
>     my $f; #nb of fuzzy msg
>     my $u; #nb of untranslated msg
>     my $t; #nb of translated msg
>     my $this_stat = ""; #stats for this file
>     my $err_msg =""; # err msg of the statistic external command (ie, msgfmt or debconf-stats)
> 
> 
> # HERE, my problem is HERE
> 
>     my $regexp_for_lang_code = "((..)([-_][a-zA-Z]*)?(@[^\.]*)?)(\.[^\.]*)?";
> 
> # That all, the rest should be ok
> 
> 
>    POFILE: foreach $file (@pofiles) {
>       File::Path::mkpath(File::Basename::dirname("$PO_ROOT/$pkg/$file"));
>         $filename = "${pkg}_$data{$pkg}{'version'}/$file";
>         $filename =~ s,/,_,g;
>         $filename = File::Basename::dirname("$file")."/".$filename;
>         my $filename_http = $filename; #To transfer files with ":" in their name over http, the file
>         $filename_http =~ s,:,\%3a,;#on the server must have the ":", but the URL must be fixed.
> 
>         if (system("gzip -c9 $file > $PO_ROOT/$pkg/$filename.gz")){
>             warn "Can't gunzip $file to $PO_ROOT/$pkg/$filename.gz : $!";
>         }
>         $this_stat="";
>         $lang ="";
>         if ($file=~ /\/$regexp_for_lang_code\.po$/){ 
>             $bad_lang =$1;
>             if (is_lang($bad_lang)) {
>                 $lang = $bad_lang;
>                 $bad_lang = "";
>             }
>         }
>         if ($lang eq "" && $file=~ /\/$regexp_for_lang_code\//){
>             $bad_lang =$1;
>             if (is_lang($bad_lang)) {
>                 $lang = $bad_lang;
>                 $bad_lang = "";
>             }
>         }
>         # The next rule is for kde-i18n and other such packages
>         if ($lang eq "" && $file =~ m,^$regexp_for_lang_code/messages,) {
>             $bad_lang = $1;
>             if (is_lang($bad_lang)) {
>                 $lang = $bad_lang;
>                 $bad_lang = "";
>             }
>         }
>         if ($lang ne "") {
>             # stats the file
> [....]
> 
> I never managed to find the regexp matching a lang code... Can someone help
> me fixing this ?

Are the language codes and country codes always two characters?  If so,
you could use the following:

     my $regexp_for_lang_code = "(([a-zA-Z]{2})([-_][a-zA-Z]{2})?(@[^\.]*)?)(\.[^\.]*)?";

It's not perfect but it is better.

Matt



Reply to: