Roland Mas �crivait :
 > Patrice Karatchentzeff (2002-03-20 08:13:19 +0100) :
 > 
 > > Denis Barbier �crivait :
 > >
 > > [...]
 > >
 > >  > je n'ai pas r�ussi � reproduire tes erreurs, mais �a vient de toute
 > >  > fa�on certainement de constructions comme
 > >  >   $foo = gettext("blah"),"\n";
 > >  > Quand tu veux concat�ner des cha�nes, il faut mettre un point et pas une
 > >  > virgule, �a te fout la zone avec les variables pass�es en arguments de
 > >  > fonctions.
 > >
 > > Intuitivement, j'aurai dit pareil mais 
 > >
 > > 1) C'est marqu� comme cela dans la doc gettext-perl
 > 
 >   Avec le = ?

Bonne question en fait. Extrait de la doc :

   INTERNATIONALIZING YOUR PROGRAM
   
   Step 1
   ------
   
   If you've already written your code, you need to
   wrap the gettext() function around all of the
   text strings. Needless to say, this is much easier if
   you do it while you write.
   
   print "Welcome to my program\n";
   
   print gettext("Welcome to my program"), "\n";
   
   Note that you probably don't want to include that newline
   in the gettext() call, nor any formatting codes such as
   HTML tags. The argument to gettext() is the text string
   in the default language or locale. This is known as the
   C locale and should probably be usually English.

donc quand on emploie print (la fonction de Perl), il n'y a pas de
��=��. Par contre, il n'y a rien sur un autre type de
construction. Comment i18nisons les exemples suivants :

   $print = "C'est pas si simple l'i18n\n"

et

   %NoteBook =
    (
      connection => [COnnection, "Connexion",         0],
      mail       => [Mail,       "Courriel",          1],
      log        => [Log,        "Journaux de bord",  0],
    )

(sachant que la l10n ici se situe dans le 2e champs bien s�r)

et 

$toto = $top -> Button
 (
   -text    => "joli bouton",
   -command => \&{kill_button},
 );

[...]

 >   Ah oui mais c'est pas pareil.  Avec print, si tu mets une virgule,
 > �a appelle print avec deux arguments, et pas avec un seul argument qui
 > est la concat�nation des deux.

Merci. Je n'avais pas fait attention � cela.

PK

PS : en attendant, je repars � z�ro en suivant les conseils de Denis.

-- 
      |\      _,,,---,,_       Patrice KARATCHENTZEFF
ZZZzz /,`.-'`'    -.  ;-;;,_   mailto:[EMAIL PROTECTED]
     |,4-  ) )-,_. ,\ (  `'-'  http://p.karatchentzeff.free.fr
    '---''(_/--'  `-'\_)       


Répondre à