Le 3 déc. 08 à 14:53, Jean-Edouard Babin a écrit :
Il y a pas mal de partie des DSA qui peut-être traduite
automatiquement
J'ai fait un petit script pour mâcher une partie de travail.
Je vous invite à l'utiliser si vous voulez traduire une DSA et
éventuellement à ajouter d'autre traduction automatique
(traduction des versions qui corrigent les problèmes par exemple)
Une nouvelle version, avec des choses assez moche à la fin, mais
j'arrive pas à faire la substitution que je veux, si il y a des
experts perl dans le coin je veux bien un coup de main.
#!env perl -w
# This script translate common part of DSA
# Written in 2000-2006 by Jean-Edouard Babin
# Copyright 2000-2005 Software in the public interest, Inc.
# This program is released under the GNU General Public License, v2.
use Getopt::Std;
#use utf8;
#binmode(STDOUT, ":utf8");
# You may put your name here to add it automatically in the translation header
my $maintainer = "";
my $output= "";
getopts('l:f:');
die "Usage: $0 -f <file> -l <LANG> > <translted_file>" if (!defined($opt_f) or !defined($opt_l));
$translation = {
'integer overflow' => {
'FR' => 'Débordement d\'entier'
},
'insecure temp file generation' => {
'FR' => 'Fichiers temporaires peu sûrs'
},
'insufficient input sanitising' => {
'FR' => 'Vérification d\'entrée manquante'
},
'several vulnerabilities' => {
'FR' => 'Plusieurs vulnérabilités'
},
'buffer overflow' => {
'FR' => 'Débordement de mémoire tampon'
},
'buffer overflows' => {
'FR' => 'Débordements de mémoire tampons'
},
'programming error' => {
'FR' => 'Erreur de programmation'
},
'heap overflow' => {
'FR' => 'Débordement de zone de mémoire du système'
},
'authorization bypass' => {
'FR' => 'Contournement d\'autorisation'
},
'insufficient input validation' => {
'FR' => 'Validations des entrées insuffisantes'
},
'denial of service' => {
'FR' => 'Déni de service'
},
'<p>We recommend that you upgrade your <package> package.</p>' => {
'FR' => '<p>Nous vous recommandons de mettre à jour votre paquet <package>.</p>'
},
'<p>We recommend that you upgrade your <package> packages.</p>' => {
'FR' => '<p>Nous vous recommandons de mettre à jour vos paquets <package>.</p>'
},
'<p>For the <distrib_release> distribution (<distrib_name>) this problem has been fixed in version <version>.</p>' => {
'FR' => '<p>Pour la distribution <distrib_release> (<distrib_name>), ce problème a été corrigé dans laversion <version>.</p>'
},
'<p>For the <distrib_release> distribution (<distrib_name>), these problems have been fixed in version <version>.</p>' => {
'FR' => '<p>Pour la distribution <distrib_release> (<distrib_name>), ces problèmes ont été corrigés dans laversion <version>.</p>'
},
'etch' => {
'FR' => 'Etch'
},
'sid' => {
'FR' => 'Sid'
},
'lenny' => {
'FR' => 'Lenny'
}
};
open(FILE, $opt_f) or die "Can't open file $opt_f : $!";
$output .= "#use wml::debian::translation-check translation=\"\" maintainer=\"$maintainer\"";
print STDERR "---------------------------------------------------\n";
print STDERR "Don't forget to complete translation-check header !\n";
print STDERR "---------------------------------------------------\n";
while(<FILE>) {
if (m|^<define-tag description>(.+?)</define-tag>$|) {
$desc = $1;
if (defined($translation->{$desc}{$opt_l})) {
$line = $_;
$line =~ s/$desc/$translation->{$desc}{$opt_l}/;
$output .= $line;
} else {
print STDERR "I was not able to find a translation for this line !\n";
print STDERR "$_\n";
print;
}
}
elsif (m|^<p>We recommend that you upgrade your (.+?) package\.</p>$|) {
$package_name = $1;
if (defined($translation->{'<p>We recommend that you upgrade your <package> package.</p>'}{$opt_l})) {
$line = $translation->{'<p>We recommend that you upgrade your <package> package.</p>'}{$opt_l};
$line =~ s/<package>/$package_name/;
$output .= "$line\n";
} else {
print STDERR "I was not able to find a translation for this line !\n";
print STDERR "$_\n";
print;
}
}
elsif (m|^<p>We recommend that you upgrade your (.+?) packages\.</p>$|) {
$package_name = $1;
if (defined($translation->{'<p>We recommend that you upgrade your <package> packages.</p>'}{$opt_l})) {
$line = $translation->{'<p>We recommend that you upgrade your <package> packages.</p>'}{$opt_l};
$line =~ s/<package>/$package_name/;
$output .= "$line\n";
} else {
print STDERR "I was not able to find a translation for this line !\n";
print STDERR "$_\n";
print;
}
}
else {
$output .= $_;
}
}
close(FILE);
#$output =~ s|<p>For.the.\S+.distribution.\S+.this.problem.has.been.fixed.in.version.\S+\.</p>|$translation->{'<p>For the <distrib_release> distribution (<distrib_name>) this problem has been fixed in version <version>.</p>'}{$opt_l}|gs;
$output =~ s|<p>For.the.(\S+).distribution.\((\S+)\),{0,1}.this.problem.has.been.fixed.in.version.(\S+)\.</p>|<p>Pour la distribution $1 ($2), ce problème a été corrigé dans laversion $3.</p>|gs;
$output =~ s|<p>For.the.(\S+).distribution.\((\S+)\),{0,1}.these.problems.have.been.fixed.in.version.(\S+)\.</p>|<p>Pour la distribution $1 ($2), ces problèmes ont été corrigés dans laversion $3.</p>|gs;
$output =~ s|\(etch\)|\(Etch\)|g;
$output =~ s|\(sid\)|\(Sid\)|g;
$output =~ s|\(lenny\)|\(Lenny\)|g;
print $output;