localize_old.pl (a893be29) localize_old.pl (6d678023)
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
4
5
6#**************************************************************
7#
8# Licensed to the Apache Software Foundation (ASF) under one

--- 104 unchanged lines hidden (view full) ---

113 if( /$sdf_regex/ ){
114 my $line = defined $_ ? $_ : '';
115 my $prj = defined $3 ? $3 : '';
116 my $file = defined $4 ? $4 : '';
117 my $type = defined $6 ? $6 : '';
118 my $gid = defined $7 ? $7 : '';
119 my $lid = defined $8 ? $8 : '';
120 my $lang = defined $12 ? $12 : '';
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
4
5
6#**************************************************************
7#
8# Licensed to the Apache Software Foundation (ASF) under one

--- 104 unchanged lines hidden (view full) ---

113 if( /$sdf_regex/ ){
114 my $line = defined $_ ? $_ : '';
115 my $prj = defined $3 ? $3 : '';
116 my $file = defined $4 ? $4 : '';
117 my $type = defined $6 ? $6 : '';
118 my $gid = defined $7 ? $7 : '';
119 my $lid = defined $8 ? $8 : '';
120 my $lang = defined $12 ? $12 : '';
121 my $plattform = defined $10 ? $10 : '';
121 my $platform = defined $10 ? $10 : '';
122 my $helpid = defined $9 ? $9 : '';
123
124 next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module
125 chomp( $line );
126 $currentFile = $srcpath . '\\' . $prj . '\\' . $file;
127 $currentFile =~ s/\\/\//g;
128
129 $cur_sdffile = $currentFile;

--- 10 unchanged lines hidden (view full) ---

140 $start='';
141 $lastFile = $currentFile; # ?
142 $last_sdffile = $cur_sdffile;
143 }
144
145 if( $lang eq "en-US" ){}
146 elsif( $cur_sdffile eq $last_sdffile )
147 {
122 my $helpid = defined $9 ? $9 : '';
123
124 next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module
125 chomp( $line );
126 $currentFile = $srcpath . '\\' . $prj . '\\' . $file;
127 $currentFile =~ s/\\/\//g;
128
129 $cur_sdffile = $currentFile;

--- 10 unchanged lines hidden (view full) ---

140 $start='';
141 $lastFile = $currentFile; # ?
142 $last_sdffile = $cur_sdffile;
143 }
144
145 if( $lang eq "en-US" ){}
146 elsif( $cur_sdffile eq $last_sdffile )
147 {
148 $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
148 $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$platform\t$lang" } = $line ;
149 }
150 else
151 {
152 writesdf( $lastFile , \%block );
153 $lastFile = $currentFile; #?
154 $last_sdffile = $cur_sdffile;
155 %block = ();
156 #if( ! $lang eq "en-US" ) {
149 }
150 else
151 {
152 writesdf( $lastFile , \%block );
153 $lastFile = $currentFile; #?
154 $last_sdffile = $cur_sdffile;
155 %block = ();
156 #if( ! $lang eq "en-US" ) {
157 $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
157 $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$platform\t$lang" } = $line ;
158 #}
159
160 }
161 } #else { print STDOUT "splitfile REGEX kaputt\n";}
162
163 }
164 writesdf( $lastFile , \%block );
165 %block = ();

--- 24 unchanged lines hidden (view full) ---

190 if( /$sdf_regex/ ){
191 my $line = defined $_ ? $_ : '';
192 my $prj = defined $3 ? $3 : '';
193 my $file = defined $4 ? $4 : '';
194 my $type = defined $6 ? $6 : '';
195 my $gid = defined $7 ? $7 : '';
196 my $lid = defined $8 ? $8 : '';
197 my $lang = defined $12 ? $12 : '';
158 #}
159
160 }
161 } #else { print STDOUT "splitfile REGEX kaputt\n";}
162
163 }
164 writesdf( $lastFile , \%block );
165 %block = ();

--- 24 unchanged lines hidden (view full) ---

190 if( /$sdf_regex/ ){
191 my $line = defined $_ ? $_ : '';
192 my $prj = defined $3 ? $3 : '';
193 my $file = defined $4 ? $4 : '';
194 my $type = defined $6 ? $6 : '';
195 my $gid = defined $7 ? $7 : '';
196 my $lid = defined $8 ? $8 : '';
197 my $lang = defined $12 ? $12 : '';
198 my $plattform = defined $10 ? $10 : '';
198 my $platform = defined $10 ? $10 : '';
199 my $helpid = defined $9 ? $9 : '';
200
201 chomp( $line );
199 my $helpid = defined $9 ? $9 : '';
200
201 chomp( $line );
202 $index{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
202 $index{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$platform\t$lang" } = $line ;
203
204 } #else { print STDOUT "writesdf REGEX kaputt $_\n";}
205
206 }
207 close( DESTFILE );
208 }
209 #### Copy new strings
210 my @mykeys = keys( %{ $blockhash_ref } );

--- 239 unchanged lines hidden (view full) ---

450 if( /$sdf_regex/ ){
451 my $line = defined $_ ? $_ : '';
452 my $prj = defined $3 ? $3 : '';
453 my $file = defined $4 ? $4 : '';
454 my $type = defined $6 ? $6 : '';
455 my $gid = defined $7 ? $7 : '';
456 my $lid = defined $8 ? $8 : '';
457 my $lang = defined $12 ? $12 : '';
203
204 } #else { print STDOUT "writesdf REGEX kaputt $_\n";}
205
206 }
207 close( DESTFILE );
208 }
209 #### Copy new strings
210 my @mykeys = keys( %{ $blockhash_ref } );

--- 239 unchanged lines hidden (view full) ---

450 if( /$sdf_regex/ ){
451 my $line = defined $_ ? $_ : '';
452 my $prj = defined $3 ? $3 : '';
453 my $file = defined $4 ? $4 : '';
454 my $type = defined $6 ? $6 : '';
455 my $gid = defined $7 ? $7 : '';
456 my $lid = defined $8 ? $8 : '';
457 my $lang = defined $12 ? $12 : '';
458 my $plattform = defined $10 ? $10 : '';
458 my $platform = defined $10 ? $10 : '';
459 my $helpid = defined $9 ? $9 : '';
460
461 chomp( $line );
462
463 if ( $lang eq $cur_lang ){
464 # Overwrite fallback strings with collected strings
465 #if( ( !has_two_sourcelanguages( $cur_lang) && $cur_lang eq "de" ) || $cur_lang ne "en-US" ){
459 my $helpid = defined $9 ? $9 : '';
460
461 chomp( $line );
462
463 if ( $lang eq $cur_lang ){
464 # Overwrite fallback strings with collected strings
465 #if( ( !has_two_sourcelanguages( $cur_lang) && $cur_lang eq "de" ) || $cur_lang ne "en-US" ){
466 $fallbackhashhash_ref->{ $cur_lang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ;
466 $fallbackhashhash_ref->{ $cur_lang }{ $prj.$gid.$lid.$file.$type.$platform.$helpid } = $line ;
467 #}
468
469 }
470 }
471 }
472 }else { print STDERR "WARNING: Can't open file $currentfile"; }
473 }
474

--- 37 unchanged lines hidden (view full) ---

512 my $timestamp = defined $18 ? $18 : '';
513
514 my $prj = defined $3 ? $3 : '';
515 my $file = defined $4 ? $4 : '';
516 my $type = defined $6 ? $6 : '';
517 my $gid = defined $7 ? $7 : '';
518 my $lid = defined $8 ? $8 : '';
519 #my $lang = defined $12 ? $12 : '';
467 #}
468
469 }
470 }
471 }
472 }else { print STDERR "WARNING: Can't open file $currentfile"; }
473 }
474

--- 37 unchanged lines hidden (view full) ---

512 my $timestamp = defined $18 ? $18 : '';
513
514 my $prj = defined $3 ? $3 : '';
515 my $file = defined $4 ? $4 : '';
516 my $type = defined $6 ? $6 : '';
517 my $gid = defined $7 ? $7 : '';
518 my $lid = defined $8 ? $8 : '';
519 #my $lang = defined $12 ? $12 : '';
520 my $plattform = defined $10 ? $10 : '';
520 my $platform = defined $10 ? $10 : '';
521 my $helpid = defined $9 ? $9 : '';
522
523
524 if( $use_default_date )
525 {
526 $extract_date = "$default_date\n" ;
527 }
528 elsif( $extract_date eq "" ) {
529 $extract_date = $timestamp ;
530 $extract_date =~ tr/\r\n//d;
531 $extract_date .= "\n";
532 }
533
534 if( $bAll ){ print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ; }
535 else {
536 foreach my $sLang ( keys( %{ $langhash_ref } ) ){
537 if( $sLang=~ /all/i ) {
521 my $helpid = defined $9 ? $9 : '';
522
523
524 if( $use_default_date )
525 {
526 $extract_date = "$default_date\n" ;
527 }
528 elsif( $extract_date eq "" ) {
529 $extract_date = $timestamp ;
530 $extract_date =~ tr/\r\n//d;
531 $extract_date .= "\n";
532 }
533
534 if( $bAll ){ print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ; }
535 else {
536 foreach my $sLang ( keys( %{ $langhash_ref } ) ){
537 if( $sLang=~ /all/i ) {
538 push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
538 push @{ $output{ $prj.$gid.$lid.$file.$type.$platform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
539 #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
540 }
541 #if( $sLang eq "de" && $lang eq "de" ) {
539 #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
540 }
541 #if( $sLang eq "de" && $lang eq "de" ) {
542 # push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
542 # push @{ $output{ $prj.$gid.$lid.$file.$type.$platform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
543 #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
544 #}
545 if( $sLang eq "en-US" && $lang eq "en-US" ) {
543 #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
544 #}
545 if( $sLang eq "en-US" && $lang eq "en-US" ) {
546 push @order , $prj.$gid.$lid.$file.$type.$plattform.$helpid;
547 if( !$bFakeEnglish ){ push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; }
546 push @order , $prj.$gid.$lid.$file.$type.$platform.$helpid;
547 if( !$bFakeEnglish ){ push @{ $output{ $prj.$gid.$lid.$file.$type.$platform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; }
548 #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
549 }
550
551 }
552 }
553 }
554 }
555 # Insert particles

--- 6 unchanged lines hidden (view full) ---

562 my $timestamp = defined $18 ? $18 : '';
563
564 #my $prj = defined $3 ? $3 : '';
565 my $file = defined $4 ? $4 : '';
566 my $type = defined $6 ? $6 : '';
567 my $gid = defined $7 ? $7 : '';
568 my $lid = defined $8 ? $8 : '';
569 #my $lang = defined $12 ? $12 : '';
548 #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
549 }
550
551 }
552 }
553 }
554 }
555 # Insert particles

--- 6 unchanged lines hidden (view full) ---

562 my $timestamp = defined $18 ? $18 : '';
563
564 #my $prj = defined $3 ? $3 : '';
565 my $file = defined $4 ? $4 : '';
566 my $type = defined $6 ? $6 : '';
567 my $gid = defined $7 ? $7 : '';
568 my $lid = defined $8 ? $8 : '';
569 #my $lang = defined $12 ? $12 : '';
570 my $plattform = defined $10 ? $10 : '';
570 my $platform = defined $10 ? $10 : '';
571 my $helpid = defined $9 ? $9 : '';
572
573
574 if( $use_default_date )
575 {
576 $extract_date = "$default_date\n" ;
577 }
578 elsif( $extract_date eq "" )
579 {
580 $extract_date = $timestamp;
581 }
582
583 if( ! ( $prj =~ /binfilter/i ) ) {
571 my $helpid = defined $9 ? $9 : '';
572
573
574 if( $use_default_date )
575 {
576 $extract_date = "$default_date\n" ;
577 }
578 elsif( $extract_date eq "" )
579 {
580 $extract_date = $timestamp;
581 }
582
583 if( ! ( $prj =~ /binfilter/i ) ) {
584 push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
584 push @{ $output{ $prj.$gid.$lid.$file.$type.$platform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
585 #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
586 }
587 }
588 }
589
590 # Write!
591 foreach my $curkey ( @order ){
592 foreach my $curlist ( $output{ $curkey } ){

--- 31 unchanged lines hidden (view full) ---

624 if( /$sdf_regex/ ){
625 my $line = defined $_ ? $_ : '';
626 my $language = defined $12 ? $12 : '';
627 my $prj = defined $3 ? $3 : '';
628 my $file = defined $4 ? $4 : '';
629 my $type = defined $6 ? $6 : '';
630 my $gid = defined $7 ? $7 : '';
631 my $lid = defined $8 ? $8 : '';
585 #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
586 }
587 }
588 }
589
590 # Write!
591 foreach my $curkey ( @order ){
592 foreach my $curlist ( $output{ $curkey } ){

--- 31 unchanged lines hidden (view full) ---

624 if( /$sdf_regex/ ){
625 my $line = defined $_ ? $_ : '';
626 my $language = defined $12 ? $12 : '';
627 my $prj = defined $3 ? $3 : '';
628 my $file = defined $4 ? $4 : '';
629 my $type = defined $6 ? $6 : '';
630 my $gid = defined $7 ? $7 : '';
631 my $lid = defined $8 ? $8 : '';
632 my $plattform = defined $10 ? $10 : '';
632 my $platform = defined $10 ? $10 : '';
633 my $helpid = defined $9 ? $9 : '';
634
633 my $helpid = defined $9 ? $9 : '';
634
635 my $leftpart = $prj.$gid.$lid.$file.$type.$plattform.$helpid;
635 my $leftpart = $prj.$gid.$lid.$file.$type.$platform.$helpid;
636
637 if( $language eq "en-US" ){ # source string found, 1. entry
638 $enusleftpart = $leftpart;
639 push @good_lines , $line;
640 }else{
641 if( !defined $enusleftpart or !defined $leftpart ){
642 print STDERR "BADLINE: $line\n";
643 print STDERR "\$enusleftpart = $enusleftpart\n";

--- 193 unchanged lines hidden (view full) ---

837 while( <MYFILE>){
838 if( /$sdf_regex/ ){
839 my $line = defined $_ ? $_ : '';
840 my $prj = defined $3 ? $3 : '';
841 my $file = defined $4 ? $4 : '';
842 my $type = defined $6 ? $6 : '';
843 my $gid = defined $7 ? $7 : '';
844 my $lid = defined $8 ? $8 : '';
636
637 if( $language eq "en-US" ){ # source string found, 1. entry
638 $enusleftpart = $leftpart;
639 push @good_lines , $line;
640 }else{
641 if( !defined $enusleftpart or !defined $leftpart ){
642 print STDERR "BADLINE: $line\n";
643 print STDERR "\$enusleftpart = $enusleftpart\n";

--- 193 unchanged lines hidden (view full) ---

837 while( <MYFILE>){
838 if( /$sdf_regex/ ){
839 my $line = defined $_ ? $_ : '';
840 my $prj = defined $3 ? $3 : '';
841 my $file = defined $4 ? $4 : '';
842 my $type = defined $6 ? $6 : '';
843 my $gid = defined $7 ? $7 : '';
844 my $lid = defined $8 ? $8 : '';
845 my $plattform = defined $10 ? $10 : '';
845 my $platform = defined $10 ? $10 : '';
846 my $lang = defined $12 ? $12 : '';
847 my $helpid = defined $9 ? $9 : '';
848
849 foreach my $isolang ( keys ( %{ $langhash_ref } ) ){
846 my $lang = defined $12 ? $12 : '';
847 my $helpid = defined $9 ? $9 : '';
848
849 foreach my $isolang ( keys ( %{ $langhash_ref } ) ){
850 if( $isolang=~ /$lang/i || $isolang=~ /all/i ) { $block{$prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; }
850 if( $isolang=~ /$lang/i || $isolang=~ /all/i ) { $block{$prj.$gid.$lid.$file.$type.$platform.$helpid } = $line ; }
851 }
852 }
853 }
854 return (\%block);
855}
856
857#########################################################
858sub read_fallbacks_from_particles{

--- 8 unchanged lines hidden (view full) ---

867 if( /$sdf_regex/ ){
868 my $line = defined $_ ? $_ : '';
869 my $prj = defined $3 ? $3 : '';
870 my $file = defined $4 ? $4 : '';
871 my $type = defined $6 ? $6 : '';
872 my $gid = defined $7 ? $7 : '';
873 my $lid = defined $8 ? $8 : '';
874 my $lang = defined $12 ? $12 : '';
851 }
852 }
853 }
854 return (\%block);
855}
856
857#########################################################
858sub read_fallbacks_from_particles{

--- 8 unchanged lines hidden (view full) ---

867 if( /$sdf_regex/ ){
868 my $line = defined $_ ? $_ : '';
869 my $prj = defined $3 ? $3 : '';
870 my $file = defined $4 ? $4 : '';
871 my $type = defined $6 ? $6 : '';
872 my $gid = defined $7 ? $7 : '';
873 my $lid = defined $8 ? $8 : '';
874 my $lang = defined $12 ? $12 : '';
875 my $plattform = defined $10 ? $10 : '';
875 my $platform = defined $10 ? $10 : '';
876 my $helpid = defined $9 ? $9 : '';
877
878 chomp( $line );
879
880 foreach my $isolang ( @{$isolanglist_ref} ){
881 if( $isolang=~ /$lang/i ) {
876 my $helpid = defined $9 ? $9 : '';
877
878 chomp( $line );
879
880 foreach my $isolang ( @{$isolanglist_ref} ){
881 if( $isolang=~ /$lang/i ) {
882 $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ;
882 $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$platform.$helpid } = $line ;
883 }
884 }
885 }
886 }
887 }else { print STDERR "WARNING: Can't open file $currentfile"; }
888 }
889}
890

--- 13 unchanged lines hidden (view full) ---

904 my $line = defined $_ ? $_ : '';
905 my $prj = defined $3 ? $3 : '';
906 my $file = defined $4 ? $4 : '';
907 my $type = defined $6 ? $6 : '';
908 my $gid = defined $7 ? $7 : '';
909 my $lid = defined $8 ? $8 : '';
910 my $helpid = defined $9 ? $9 : '';
911 my $lang = defined $12 ? $12 : '';
883 }
884 }
885 }
886 }
887 }else { print STDERR "WARNING: Can't open file $currentfile"; }
888 }
889}
890

--- 13 unchanged lines hidden (view full) ---

904 my $line = defined $_ ? $_ : '';
905 my $prj = defined $3 ? $3 : '';
906 my $file = defined $4 ? $4 : '';
907 my $type = defined $6 ? $6 : '';
908 my $gid = defined $7 ? $7 : '';
909 my $lid = defined $8 ? $8 : '';
910 my $helpid = defined $9 ? $9 : '';
911 my $lang = defined $12 ? $12 : '';
912 my $plattform = defined $10 ? $10 : '';
912 my $platform = defined $10 ? $10 : '';
913
914 chomp( $line );
913
914 chomp( $line );
915 if( $isolang=~ /$lang/i ) { $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ;
915 if( $isolang=~ /$lang/i ) { $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$platform.$helpid } = $line ;
916 }
917 }
918 }
919}
920
921#########################################################
922sub parseLanguages{
923

--- 119 unchanged lines hidden (view full) ---

1043# my $leftpart = defined $2 ? $2 : '';
1044# my $prj = defined $3 ? $3 : '';
1045# my $file = defined $4 ? $4 : '';
1046# my $dummy = defined $5 ? $5 : '';
1047# my $type = defined $6 ? $6 : '';
1048# my $gid = defined $7 ? $7 : '';
1049# my $lid = defined $8 ? $8 : '';
1050# my $helpid = defined $9 ? $9 : '';
916 }
917 }
918 }
919}
920
921#########################################################
922sub parseLanguages{
923

--- 119 unchanged lines hidden (view full) ---

1043# my $leftpart = defined $2 ? $2 : '';
1044# my $prj = defined $3 ? $3 : '';
1045# my $file = defined $4 ? $4 : '';
1046# my $dummy = defined $5 ? $5 : '';
1047# my $type = defined $6 ? $6 : '';
1048# my $gid = defined $7 ? $7 : '';
1049# my $lid = defined $8 ? $8 : '';
1050# my $helpid = defined $9 ? $9 : '';
1051# my $plattform = defined $10 ? $10 : '';
1051# my $platform = defined $10 ? $10 : '';
1052# my $width = defined $11 ? $11 : '';
1053# my $lang = defined $12 ? $12 : '';
1054# my $rightpart = defined $13 ? $13 : '';
1055# my $text = defined $14 ? $14 : '';
1056# my $helptext = defined $15 ? $15 : '';
1057# my $quickhelptext = defined $16 ? $16 : '';
1058# my $title = defined $17 ? $17 : '';
1059# my $timestamp = defined $18 ? $18 : '';
1060
1052# my $width = defined $11 ? $11 : '';
1053# my $lang = defined $12 ? $12 : '';
1054# my $rightpart = defined $13 ? $13 : '';
1055# my $text = defined $14 ? $14 : '';
1056# my $helptext = defined $15 ? $15 : '';
1057# my $quickhelptext = defined $16 ? $16 : '';
1058# my $title = defined $17 ? $17 : '';
1059# my $timestamp = defined $18 ? $18 : '';
1060