I've been able to figure out the first file and create a dsl. I include the script I used as the Freelang page has many dictionaries and someone might find it useful or refine the script. Note that I had to convert the resulting file to UTF-16, as goldendict didn't recognize the original iso-8859-1 text (use recode, iconv or whatever suits you).
Usage: ./free2dsl.pl name.wb > name.dsl.
The forum doesn't allow .pl or .txt attachments, so I'll just paste it here:
- Code: Select all
#!/usr/bin/perl
use strict;
use File::Basename;
my $cp="1252";
my $c=0;
my $l;
my $txt;
die "Usage: $0 filename\n" if ($#ARGV<0);
my ($name,$path,$suffix) = fileparse($ARGV[0]);
&cabecera(substr($name,0,rindex($name,'.')),$cp);
open(ORIGEN,"<$ARGV[0]") or die "Can't open $ARGV[0]\n";
binmode(ORIGEN);
while (read (ORIGEN, $l, 1) != 0) {
if (ord($l)>31) {
$txt.=$l;
}
else {
if (length($txt)) {
$c++;
print " " unless ($c%2);
print $txt."\n";
print "\n" unless ($c%2);
$txt="";
}
}
}
close(ORIGEN);
print STDERR ($c/2)." definitions found.\n";
sub cabecera {
my $nombre=shift;
my $cp=shift;
print "#NAME \"$nombre\"\n";
print "#INDEX_LANGUAGE \"".substr($nombre,0,rindex($nombre,'_'))."\"\n";
print "#CONTENTS_LANGUAGE \"".substr($nombre,1+index($nombre,'_'))."\"\n\n";
#print "#SOURCE_CODE_PAGE \"$cp\"\n\n";
}