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

Re: Traduction des DSA



Une version plus recente qui fonctionne mieux :)

#!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'
		},
		'cross-site scripting' => {
			'FR' => 'Script intersite'
		},
		'design flaw' => {
			'FR' => 'Défaut de conception'
		},
		'design flaws' => {
			'FR' => 'Défauts de conception'
		},
		'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 lav ersion <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 la version <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\"\n";
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";
			$output .= $_;
		}
	}
	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";
			$output .= $_;
		}
	}
	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";
			$output .= $_;
		}
	}
	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 la version $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 la version $3.</p>|gs;
$output =~ s|\(etch\)|\(Etch\)|g;
$output =~ s|\(sid\)|\(Sid\)|g;
$output =~ s|\(lenny\)|\(Lenny\)|g;

print $output;





Le 5 déc. 08 à 01:10, Stéphane Blondon a écrit :

2008/12/5 Jean-Edouard Babin <radius@gmail.com>:
si il y a des experts perl dans le
coin je veux bien un coup de main.


Pas moi en tout cas. J'ai préféré apprendre Python[1].

ça ne résoudra pas tes problèmes mais à la fin des lignes 131 et 132, on trouve:
...dans laversion $3.</p>|gs;

Cela devrait être :
...dans la version $3.</p>|gs;

(ajout de l'espace entre "la" et "version".)
Oui, c'est pas super technique comme remarque, mais je ne pas faire
beaucoup mieux.


[1]Pour être complet, je préfère emacs à vi aussi. :-)
--
Stéphane.


--
To UNSUBSCRIBE, email to debian-l10n-french-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: