* Add a set of palettes contributed by Nitrofurano. Thanks !
* Add a small python script to convert palettes back to the old .PAL format if you ever need it. * Update wiki page about palette to link to the new palettes ( I din't know where to put that) * also moved "translation" tools to the "tools" folder along with the convert script git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1283 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
52
tools/translat/translate.pl
Normal file
52
tools/translat/translate.pl
Normal file
@@ -0,0 +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 = <FRENCH>) & ($english=<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";
|
||||
}
|
||||
#}
|
||||
Reference in New Issue
Block a user