koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/misc/translator tmpl_process.pl,1.5,1.5.2.1


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/misc/translator tmpl_process.pl,1.5,1.5.2.1
Date: Thu, 08 Jan 2004 07:59:13 -0800

Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1:/tmp/cvs-serv28465/misc/translator

Modified Files:
      Tag: rel_2_0
        tmpl_process.pl 
Log Message:
adding "UNUSED feature". Now, unused strings are shown with "UNUSED;" before 
the translation if it appears. If you are sure the string will not be 
reintroduced later, you can delete it.


Index: tmpl_process.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/tmpl_process.pl,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -r1.5 -r1.5.2.1
*** tmpl_process.pl     9 Dec 2003 10:26:51 -0000       1.5
--- tmpl_process.pl     8 Jan 2004 15:59:11 -0000       1.5.2.1
***************
*** 75,79 ****
  {
        # restores the string list from file
!       %strhash = &restore_strhash(\%strhash, $str_file, $split_char);
        # updates the list, adding new entries if any
        %strhash = &update_strhash(\%strhash, address@hidden, $exclude_regex, 
$filter);
--- 75,79 ----
  {
        # restores the string list from file
!       %strhash = &restore_strhash(\%strhash, $str_file, $split_char,1);
        # updates the list, adding new entries if any
        %strhash = &update_strhash(\%strhash, address@hidden, $exclude_regex, 
$filter);
***************
*** 95,99 ****
  
        # restores the string list from file
!       %strhash = &restore_strhash(\%strhash, $str_file, $split_char);
        # creates the new tmpl file using the new translation
        &install_strhash(\%strhash, address@hidden, $in_dir, $out_dir);
--- 95,99 ----
  
        # restores the string list from file
!       %strhash = &restore_strhash(\%strhash, $str_file, $split_char,0);
        # creates the new tmpl file using the new translation
        &install_strhash(\%strhash, address@hidden, $in_dir, $out_dir);
***************
*** 160,164 ****
                        exit(1);
                }
!               
                # opens handle for output
                if( !open($fh_out, "> $out_file") )
--- 160,164 ----
                        exit(1);
                }
! 
                # opens handle for output
                if( !open($fh_out, "> $out_file") )
***************
*** 173,178 ****
                while(my $line = <$fh_in>)
                {
!                       foreach my $text (sort  {length($b) <=> length($a)} 
keys %{$strhash})
                        {
                                # Test if the key has been translated
                                if( %{$strhash}->{$text} != 1 )
--- 173,180 ----
                while(my $line = <$fh_in>)
                {
!                       foreach my $text (sort  {uc($b) cmp uc($a) || 
length($b) <=> length($a)} keys %{$strhash})
                        {
+ #                     $text =~ s/\'/\\\'/g;
+ #                     $text =~ s/\./\\\./g;
                                # Test if the key has been translated
                                if( %{$strhash}->{$text} != 1 )
***************
*** 236,239 ****
--- 238,244 ----
                                                # the line is not already in 
the list so add it
                                                %{$strhash}->{$str}=1;
+                                       } else {
+                                               # remove UNUSED;
+                                               %{$strhash}->{$str} =~ 
s/^UNUSED;//;
                                        }
                                }
***************
*** 253,258 ****
  sub restore_strhash
  {
!       my($strhash, $str_file, $split_char) = @_;
!       
        my $fh;
        
--- 258,263 ----
  sub restore_strhash
  {
!       my($strhash, $str_file, $split_char, $detect_unused) = @_;
! 
        my $fh;
        
***************
*** 260,264 ****
        
        print "Restoring string list from $str_file...\n";
!       
        while( my $line = <$fh> )
        {
--- 265,269 ----
        
        print "Restoring string list from $str_file...\n";
! 
        while( my $line = <$fh> )
        {
***************
*** 278,281 ****
--- 283,289 ----
                        %{$strhash}->{$original} = 1;
                }
+               if ($detect_unused) {
+                       %{$strhash}->{$original} = 
"UNUSED;".%{$strhash}->{$original} unless %{$strhash}->{$original}=~ /^UNUSED;/;
+               }
  
        }
***************
*** 301,307 ****
        print "Writing string list to $str_file...\n";
  
!       foreach my $str(sort {uc($a) cmp uc($b) || length($a) <=> length($b)} 
keys %{$strhash})
        {
!               if(%{$strhash}->{$str} != 1)
                {
                        printf($fh "%s%s%s\n", $str, $split_char, 
%{$strhash}->{$str});
--- 309,315 ----
        print "Writing string list to $str_file...\n";
  
!       foreach my $str(sort {uc($a) cmp uc($b) || length($b) <=> length($a)} 
keys %{$strhash})
        {
!               if(%{$strhash}->{$str}!=1)
                {
                        printf($fh "%s%s%s\n", $str, $split_char, 
%{$strhash}->{$str});
***************
*** 458,459 ****
--- 466,468 ----
        exit(0);
  }
+ 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]