koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/misc/translator intranet.en,1.1,1.1.2.1 intranet.fr


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/misc/translator intranet.en,1.1,1.1.2.1 intranet.fr,1.1,1.1.2.1 opac-css.fr,1.1.2.2,1.1.2.3 tmpl_process.pl,1.5.2.2,1.5.2.3 translator_doc.txt,1.1,1.1.2.1
Date: Fri, 16 Jan 2004 08:24:21 -0800

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

Modified Files:
      Tag: rel_2_0
        intranet.en intranet.fr opac-css.fr tmpl_process.pl 
        translator_doc.txt 
Log Message:
improving translator tool a lot :
* managing strings with LIMITED pragma when the string is a koha intenral code 
too (like search)
* improving speed by 50 : just by reading the whole file before s///g, instead 
of doing a s///g on each line.
* NOT overwritting unchanged file => now, we can commit only what has changed !
* removing useless chars (., ?, spaces...) at end of strings.

WORKS on french OPAC AND INTRANET without problems.

Index: intranet.en
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/intranet.en,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -r1.1 -r1.1.2.1
*** intranet.en 9 Dec 2003 10:26:51 -0000       1.1
--- intranet.en 16 Jan 2004 16:24:19 -0000      1.1.2.1
***************
*** 1,7 ****
! 0     *****
! A     *****
! A "thesaurus category": it refers to a thesaurus category. See the 
corresponding admin table. *****
! A "value builder": values builders are perl programs that help you select the 
value of the field. They are MARC-flavor dependant and sometimes fill another 
subfield automatically.   *****
! A MARC record is stored in the breeding farm as long as you have no item. 
When you type the ISBN or title of a biblio, it's searched for in the breeding 
farm. If it is found, the biblio is added to Koha active table and removed from 
the breeding farm.   *****
  About *****
  Abstract      *****
--- 1,4 ----
! A "thesaurus category": it refers to a thesaurus category. See the 
corresponding admin table  *****
! A "value builder": values builders are perl programs that help you select the 
value of the field. They are MARC-flavor dependant and sometimes fill another 
subfield automatically    *****
[...1295 lines suppressed...]
  Yes   *****
  yes   *****
+ YES   *****
  Yes, See below        *****
  YesNo *****
  You   *****
! You are accessing Koha from a different ip address! Please login again        
*****
  You can enter a name for this import. It may be useful, when creating a 
biblio, to remember where the suggested MARC data comes from! *****
  You did not specify any seach criteria        *****
! You entered an incorrect username or password. Please try again       *****
  You have  error(s) in your MARC configuration. Please fix them before using 
koha      *****
  You have the following books waiting to be picked up  *****
***************
*** 1110,1114 ****
  You searched on       *****
  Young Adult Fiction   *****
- Z     *****
  Z39.50 Search *****
  Z39.50 Server *****
--- 1082,1085 ----

Index: intranet.fr
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/intranet.fr,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -r1.1 -r1.1.2.1
*** intranet.fr 9 Dec 2003 10:26:51 -0000       1.1
--- intranet.fr 16 Jan 2004 16:24:19 -0000      1.1.2.1
***************
*** 1,140 ****
! 0     *****
! A     *****
! A "thesaurus category": it refers to a thesaurus category. See the 
corresponding admin table. *****
! A "value builder": values builders are perl programs that help you select the 
value of the field. They are MARC-flavor dependant and sometimes fill another 
subfield automatically.   *****
! A MARC record is stored in the breeding farm as long as you have no item. 
When you type the ISBN or title of a biblio, it's searched for in the breeding 
farm. If it is found, the biblio is added to Koha active table and removed from 
the breeding farm.   *****
! About *****
! Abstract      *****
  Account for   *****
! Account Management Fee        *****
! ACCOUNTING DETAILS    *****
[...2157 lines suppressed...]
! You are accessing Koha from a different ip address! Please login again        
Vous avez changé d'adresse IP. Identifiez-vous à nouveau
! You can enter a name for this import. It may be useful, when creating a 
biblio, to remember where the suggested MARC data comes from! Vous pouvez 
nommer ce fichier d'importation. Cela peut servir lors de la création de notice 
biblio pour se souvenir d'où viennent les données MARC par défaut.
! You did not specify any seach criteria        Vous n'avez pas spécifié de 
critère
! You entered an incorrect username or password. Please try again       
Identifiant ou mot de passe erroné. Essayez encore
! You have  error(s) in your MARC configuration. Please fix them before using 
koha      Vous avez des erreurs dans votre configuration MARC. Corrigez-les 
avant d'utiliser Koha
! You have the following books waiting to be picked up  Vous avez les livres 
suivants en attente
! You have the following requests for items on loan     Vous avez les demandes 
suivantes pour des ouvrages en prêt
! You must create a new group for your item to be added to      Vous devez 
créer un nouveau groupe pour ajouter vos ouvrages
! You must give the item a barcode      Vous devez attribuer un code barre à 
l'ouvrage
! You searched for      Votre recherche sur
! You Searched for      Votre recherche sur
! You searched on       Recherche effectuée sur
! Young Adult Fiction   Fiction Ados
! Z39.50 Search Recherche Z39.50
! Z39.50 Server Serveur Z39.50
! Z39.50 Servers        Serveurs Z39.50
! Z39.50 Servers admin  Admin Serveurs Z39.50
! z3950 search  Recherche Z39.50
! Z3950 Search Results  Résultats Recherche Z39.50
! Zipcode / Town        Code postale / Localité

Index: opac-css.fr
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/Attic/opac-css.fr,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** opac-css.fr 12 Jan 2004 09:58:23 -0000      1.1.2.2
--- opac-css.fr 16 Jan 2004 16:24:19 -0000      1.1.2.3
***************
*** 22,26 ****
  Charges       Charges
  City  Ville
! class IGNORE
  class="hilighted">    *****
  Classification        Classification
--- 22,26 ----
  Charges       Charges
  City  Ville
! class LIMITED;classe
  class="hilighted">    *****
  Classification        Classification
***************
*** 54,58 ****
  Illustrator   Illustrateur
  Impossible to set reserve because     Impossible de réserver parce que
! in    dans
  ISBN  ISBN
  Item  Exemplaire
--- 54,58 ----
  Illustrator   Illustrateur
  Impossible to set reserve because     Impossible de réserver parce que
! in    en
  ISBN  ISBN
  Item  Exemplaire
***************
*** 67,71 ****
  Jul   Juill
  Jun   Juin
! keyword       mot-clef
  Koha  Koha
  koha  koha
--- 67,71 ----
  Jul   Juill
  Jun   Juin
! keyword       LIMITED;mot-clef
  Koha  Koha
  koha  koha
***************
*** 79,84 ****
  Library Card  Carte lecteur
  Loan Length   Durée prêt
! Location      Localisation
! location      localisation
  Log In        S'identifier
  Log In to Koha        S'identifier
--- 79,84 ----
  Library Card  Carte lecteur
  Loan Length   Durée prêt
! Location      LIMITED:Localisation
! location      LIMITED;Localisation
  Log In        S'identifier
  Log In to Koha        S'identifier
***************
*** 135,139 ****
  Results  through  of  records.        résultats de à
  results found Réponses trouvées
! search        IGNORE
  Search the catalogue  Chercher dans le catalogue
  Sep   Sep
--- 135,139 ----
  Results  through  of  records.        résultats de à
  results found Réponses trouvées
! search        LIMITED:chercher
  Search the catalogue  Chercher dans le catalogue
  Sep   Sep
***************
*** 158,162 ****
  Total Due     Total dû
  Total Number of Items Nombre total d'exemplaires
! Try another   Essayez un autre
  type  type
  Unititle      Titre unifié
--- 158,162 ----
  Total Due     Total dû
  Total Number of Items Nombre total d'exemplaires
! Try another   Essayez une autre
  type  type
  Unititle      Titre unifié

Index: tmpl_process.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/tmpl_process.pl,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -C2 -r1.5.2.2 -r1.5.2.3
*** tmpl_process.pl     12 Jan 2004 09:58:23 -0000      1.5.2.2
--- tmpl_process.pl     16 Jan 2004 16:24:19 -0000      1.5.2.3
***************
*** 117,122 ****
        my $tmp_dir; # temporary directory name (used to create destination dir)
  
!       $out_dir =~ s/\/$//; # chops the trailing / if any.
  
        # Processes every entry found.
        foreach my $file (@{$in_files})
--- 117,141 ----
        my $tmp_dir; # temporary directory name (used to create destination dir)
  
!       my $starttime = time();
  
+       $out_dir =~ s/\/$//; # chops the trailing / if any.
+       foreach my $text (keys %{$strhash})
+               {
+                       # escaping \|()[{}^$*+?.
+                       %{$strhash}->{$text} =~ s/\\/\\\\/g;
+                       %{$strhash}->{$text} =~ s/\|/\\\|/g;
+                       %{$strhash}->{$text} =~ s/\(/\\\(/g;
+                       %{$strhash}->{$text} =~ s/\)/\\\)/g;
+                       %{$strhash}->{$text} =~ s/\[/\\\[/g;
+                       %{$strhash}->{$text} =~ s/\]/\\\]/g;
+                       %{$strhash}->{$text} =~ s/\{/\\\{/g;
+                       %{$strhash}->{$text} =~ s/\}/\\\}/g;
+                       %{$strhash}->{$text} =~ s/\^/\\\^/g;
+                       %{$strhash}->{$text} =~ s/\$/\\\$/g;
+                       %{$strhash}->{$text} =~ s/\*/\\\*/g;
+                       %{$strhash}->{$text} =~ s/\+/\\\+/g;
+                       %{$strhash}->{$text} =~ s/\?/\\\?/g;
+ #                     %{$strhash}->{$text} =~ s/\./\\\./g;
+               }
        # Processes every entry found.
        foreach my $file (@{$in_files})
***************
*** 130,133 ****
--- 149,153 ----
                # generates the name of the output file
                my $out_file = $file;
+               my $out_file_tmp = $file.".tmp"; # used to check if file has 
changed or not.
  
                if(!defined $in_dir)
***************
*** 162,166 ****
  
                # opens handle for output
!               if( !open($fh_out, "> $out_file") )
                {
                        warn "Can't write $out_file : $!\n";
--- 182,186 ----
  
                # opens handle for output
!               if( !open($fh_out, "> $out_file_tmp") )
                {
                        warn "Can't write $out_file : $!\n";
***************
*** 168,214 ****
                        next;
                }
! 
!               print "Generating $out_file...\n";
! 
                while(my $line = <$fh_in>)
                {
!                       foreach my $text (sort  {uc($b) cmp uc($a) || 
length($b) <=> length($a)} keys %{$strhash})
                        {
!                       # escaping \|()[{}^$*+?.
!                       $text =~ s/\\/\\\\/g;
!                       $text =~ s/\|/\\\|/g;
!                       $text =~ s/\(/\\\(/g;
!                       $text =~ s/\)/\\\)/g;
!                       $text =~ s/\[/\\\[/g;
!                       $text =~ s/\]/\\\]/g;
!                       $text =~ s/\{/\\\{/g;
!                       $text =~ s/\}/\\\}/g;
!                       $text =~ s/\^/\\\^/g;
!                       $text =~ s/\$/\\\$/g;
!                       $text =~ s/\*/\\\*/g;
!                       $text =~ s/\+/\\\+/g;
!                       $text =~ s/\?/\\\?/g;
!                       $text =~ s/\?/\\\?/g;
!                               # Test if the key has been translated
!                               if( %{$strhash}->{$text} != 1 )
                                {
!                                       # Does the line contains text that 
needs to be changed ?
!                                       if( $line =~ /$text/ && 
%{$strhash}->{$text} ne "IGNORE")
                                        {
                                                # changing text
                                                my $subst = 
%{$strhash}->{$text};
!                                               $line =~ 
s/(\W)$text(\W)/$1$subst$2/g;
                                        }
                                }
                        }
-                       $line =~ s/\<TMPL_(.*?)\>/\<\!-- TMPL_$1 --\>/g;
-                       $line =~ s/\<\/TMPL_(.*?)\>/\<\!-- \/TMPL_$1 --\>/g;
-                       # Writing the modified (or not) line to output
-                       printf($fh_out "%s", $line);
                }
! 
                close($fh_in);
                close($fh_out);
        }
  }
  
--- 188,268 ----
                        next;
                }
!               my $lines;
                while(my $line = <$fh_in>)
                {
!                       $lines.=$line;
!               }
!               foreach my $text (sort  {length($b) <=> length($a) || uc($b) 
cmp uc($a) } keys %{$strhash})
!               {
!               # Test if the key has been translated
!               if( %{$strhash}->{$text} != 1)
                        {
!                               # Does the file contains text that needs to be 
changed ?
!                               if( $lines =~ /$text/ && %{$strhash}->{$text} 
ne "IGNORE" )
                                {
!                                       if (%{$strhash}->{$text} =~ "LIMITED")
                                        {
                                                # changing text
                                                my $subst = 
%{$strhash}->{$text};
!                                               # escaping \|()[{}^$*+?.
!                                               $text =~ s/\\/\\\\/g;
!                                               $text =~ s/\|/\\\|/g;
!                                               $text =~ s/\(/\\\(/g;
!                                               $text =~ s/\)/\\\)/g;
!                                               $text =~ s/\[/\\\[/g;
!                                               $text =~ s/\]/\\\]/g;
!                                               $text =~ s/\{/\\\{/g;
!                                               $text =~ s/\}/\\\}/g;
!                                               $text =~ s/\^/\\\^/g;
!                                               $text =~ s/\$/\\\$/g;
!                                               $text =~ s/\*/\\\*/g;
!                                               $text =~ s/\+/\\\+/g;
!                                               $text =~ s/\?/\\\?/g;
!                                               $subst =~ s/^LIMITED;//g;
!                                               $lines =~ 
s/(.*)>$text/$1>$subst/g;
!                                               $lines =~ s/(.*) 
title="$text/$1 title="$subst/g;
!                                               $lines =~ s/(.*) alt="$text/$1 
alt="$subst/g;
!                                       } else {
!                                               # changing text
!                                               my $subst = 
%{$strhash}->{$text};
!                                               # escaping \|()[{}^$*+?.
!                                               $text =~ s/\\/\\\\/g;
!                                               $text =~ s/\|/\\\|/g;
!                                               $text =~ s/\(/\\\(/g;
!                                               $text =~ s/\)/\\\)/g;
!                                               $text =~ s/\[/\\\[/g;
!                                               $text =~ s/\]/\\\]/g;
!                                               $text =~ s/\{/\\\{/g;
!                                               $text =~ s/\}/\\\}/g;
!                                               $text =~ s/\^/\\\^/g;
!                                               $text =~ s/\$/\\\$/g;
!                                               $text =~ s/\*/\\\*/g;
!                                               $text =~ s/\+/\\\+/g;
!                                               $text =~ s/\?/\\\?/g;
!                                               $lines =~ 
s/(\W)$text(\W)/$1$subst$2/g;
                                        }
                                }
                        }
                }
!               $lines =~ s/\<TMPL_(.*?)\>/\<\!-- TMPL_$1 --\>/g;
!               $lines =~ s/\<\/TMPL_(.*?)\>/\<\!-- \/TMPL_$1 --\>/g;
!               # Writing the modified (or not) file to output
!               printf($fh_out "%s", $lines);
                close($fh_in);
                close($fh_out);
+               # check if fh_out and previous fh_out has changed or not.
+               my $diff = `diff $out_file $out_file_tmp`;
+               if ($diff) {
+                       print "WRITING : $out_file\n";
+                       unlink $out_file;
+                       system("mv $out_file_tmp $out_file");
+               } else {
+                       print "no changes in $out_file\n";
+                       unlink $out_file_tmp;
+               }
        }
+       my $timeneeded = time() - $starttime;
+       print "done in $timeneeded seconds\n";
+ 
  }
  
***************
*** 239,243 ****
                        $str =~ s/[\n\r\f]+$//; # chomps the trailing \n (or 
<cr><lf> if file was edited with Windows)
                        $str =~ s/^\s+//; # remove trailing blanks, ':' or '*'
!                       $str =~ s/\s*\**:*\s*$//;
  
                        # the line begins with letter(s) followed by optional 
words and/or spaces
--- 293,297 ----
                        $str =~ s/[\n\r\f]+$//; # chomps the trailing \n (or 
<cr><lf> if file was edited with Windows)
                        $str =~ s/^\s+//; # remove trailing blanks, ':' or '*'
!                       $str =~ s/[\s\*:\[*\(|\.,]*$//;
  
                        # the line begins with letter(s) followed by optional 
words and/or spaces
***************
*** 330,334 ****
                else
                {
!                       printf($fh "%s%s%s\n", $str, $split_char,"*****") 
unless ($str >0);
                }
        }
--- 384,388 ----
                else
                {
!                       printf($fh "%s%s%s\n", $str, $split_char,"*****") 
unless ($str >0 || length($str) eq 1);
                }
        }

Index: translator_doc.txt
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/translator_doc.txt,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -r1.1 -r1.1.2.1
*** translator_doc.txt  5 Dec 2003 16:53:46 -0000       1.1
--- translator_doc.txt  16 Jan 2004 16:24:19 -0000      1.1.2.1
***************
*** 1,3 ****
! TRANSLATION TOOL :
  ============
  This transation tool should greatly help Koha translators.
--- 1,3 ----
! TRANSLATION TOOL , V2.0:
  ============
  This transation tool should greatly help Koha translators.
***************
*** 16,20 ****
  1- create your translation file :
  ./tmpl_process.pl update -i 
/home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default/en/ -s opac.fr -r
! 2- translate your opac.fr file (english & french being separated by a tab
  3- create your translated version :
  ./tmpl_process.pl install -i 
/home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default/en/ -o 
/home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default/fr2/ -s opac.fr -r
--- 16,20 ----
  1- create your translation file :
  ./tmpl_process.pl update -i 
/home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default/en/ -s opac.fr -r
! 2- translate your opac.fr file (english & french being separated by a tab, 
using IGNORE and LIMITED pragmas, see below)
  3- create your translated version :
  ./tmpl_process.pl install -i 
/home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default/en/ -o 
/home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default/fr2/ -s opac.fr -r
***************
*** 39,44 ****
  words that are in the templates and in a perl script name are replaced !
  For example : Search is replace by Recherche in french, thus,giving <a 
href="cgi-bin/opac-Recherche.pl">, which is wrong...
! The only way I've found to solve this is to ignore any translation whose 
translation string is IGNORE
! (search is the only cas i've found in french opac)
  
  - MISSING STRINGS
--- 39,55 ----
  words that are in the templates and in a perl script name are replaced !
  For example : Search is replace by Recherche in french, thus,giving <a 
href="cgi-bin/opac-Recherche.pl">, which is wrong...
! 2 ways to solve this problem, IGNORE & LIMITED pragma.
! IGNORE :
! if a line in translation file is :
! this_original_string  IGNORE
! it is ignored during translation.
! LIMITED :
! if a line in translation file is :
! this_original_string LIMITED;the_translation_string
! The string is translated only if :
! * has a > just before
! * has <space>title=" just before
! * has <space>alt=" just before.
! This prevent stupid replaces, at the cost of some missing translation maybe.
  
  - MISSING STRINGS




reply via email to

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