From f8de20fc8dfe026a08ff1fb2a216287791d8a0a7 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Thu, 21 Jun 2018 15:32:22 +0200 Subject: [PATCH] fix line endings of translate.pl --- tools/translat/translate.pl | 104 ++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/tools/translat/translate.pl b/tools/translat/translate.pl index baf74b65..992110bf 100644 --- a/tools/translat/translate.pl +++ b/tools/translat/translate.pl @@ -1,52 +1,52 @@ -#!/usr/bin/perl -# Translate words in file(s) given on command-line. Saves older as .bak -# The dictionary is read as 2 files, french.txt and english.txt -# Method: regexp search, ^word then ^non-word then ^word then ... -# Each word is translated according to a hash dictionary - -# Released to public domain. - -unless ( open (FRENCH, "french.txt")) { - die "Impossible to open 'french.txt' file.\n"; -} -unless ( open (ENGLISH, "english.txt")) { - die "Impossible to open 'english.txt' file.\n"; -} - -# Build french->english dictionary (a hash) -while(($french = ) & ($english=)){ - chop($french); - chop($english); - if ("$french" ne "$english") - { - $dictionary{$french} = $english; - } -} - -#foreach $name (@ARGV) { -#print "$name"; - -$^I = ".bak"; -# Read input -while ($line = <>){ - chop $line; - while ($line ne "") { - # word - if ($line =~ m/^(\w+)(.*)$/) { - if (defined $dictionary{$1}) { - print $dictionary{$1}; - } - else { - print "$1"; - } - $line=$2; - } - # non-word - if ($line =~ m/^([^\w]+)(.*)$/) { - print "$1"; - $line=$2; - } - } - print "\n"; -} -#} \ No newline at end of file +#!/usr/bin/perl +# Translate words in file(s) given on command-line. Saves older as .bak +# The dictionary is read as 2 files, french.txt and english.txt +# Method: regexp search, ^word then ^non-word then ^word then ... +# Each word is translated according to a hash dictionary + +# Released to public domain. + +unless ( open (FRENCH, "french.txt")) { + die "Impossible to open 'french.txt' file.\n"; +} +unless ( open (ENGLISH, "english.txt")) { + die "Impossible to open 'english.txt' file.\n"; +} + +# Build french->english dictionary (a hash) +while(($french = ) & ($english=)){ + chop($french); + chop($english); + if ("$french" ne "$english") + { + $dictionary{$french} = $english; + } +} + +#foreach $name (@ARGV) { +#print "$name"; + +$^I = ".bak"; +# Read input +while ($line = <>){ + chop $line; + while ($line ne "") { + # word + if ($line =~ m/^(\w+)(.*)$/) { + if (defined $dictionary{$1}) { + print $dictionary{$1}; + } + else { + print "$1"; + } + $line=$2; + } + # non-word + if ($line =~ m/^([^\w]+)(.*)$/) { + print "$1"; + $line=$2; + } + } + print "\n"; +} +#}