2002-09-17 07:17:25 +00:00
|
|
|
#!/usr/bin/perl -s
|
2006-04-03 21:11:11 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
2008-02-17 23:42:38 +00:00
|
|
|
# Copyright (C) 2006 - 2008 by Daniel Stenberg
|
2006-04-03 21:11:11 +00:00
|
|
|
#
|
|
|
|
|
2009-10-04 22:25:52 +00:00
|
|
|
# See apps/language.c (TODO: Use common include for both)
|
|
|
|
# Cookie and binary version for the binary lang file
|
|
|
|
my $LANGUAGE_COOKIE = 0x1a;
|
2009-10-18 00:56:42 +00:00
|
|
|
my $LANGUAGE_VERSION = 0x06;
|
2009-10-05 11:43:38 +00:00
|
|
|
my $LANGUAGE_FLAG_RTL = 0x01;
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2009-10-18 00:56:42 +00:00
|
|
|
my $HEADER_SIZE = 4;
|
|
|
|
my $SUBHEADER_SIZE = 6;
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# A note for future users and readers: The original v1 language system allowed
|
|
|
|
# the build to create and use a different language than english built-in. We
|
|
|
|
# removed that feature from our build-system, but the build scripts still had
|
|
|
|
# the ability. But, starting now, this ability is no longer provided since I
|
|
|
|
# figured it was boring and unnecessary to write support for now since we
|
|
|
|
# don't use it anymore.
|
2009-03-03 01:38:26 +00:00
|
|
|
|
|
|
|
|
2002-09-16 15:01:38 +00:00
|
|
|
if(!$ARGV[0]) {
|
|
|
|
print <<MOO
|
2009-10-05 06:11:00 +00:00
|
|
|
Usage: genlang [options] <langv2 file>
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
-p=<prefix>
|
|
|
|
Make the tool create a [prefix].c and [prefix].h file.
|
|
|
|
|
|
|
|
-b=<outfile>
|
2007-08-05 19:19:39 +00:00
|
|
|
Make the tool create a binary language (.lng) file named [outfile].
|
|
|
|
The use of this option requires that you also use -e, -t and -i.
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
-u
|
|
|
|
Update language file. Given the translated file and the most recent english
|
|
|
|
file, you\'ll get an updated version sent to stdout. Suitable action to do
|
|
|
|
when you intend to update a translation.
|
|
|
|
|
|
|
|
-e=<english lang file>
|
|
|
|
Point out the english (original source) file, to use that as master
|
2008-08-17 12:25:39 +00:00
|
|
|
language template. Used in combination with -b, -u or -s.
|
|
|
|
|
|
|
|
-s
|
|
|
|
Sort the Update language file in the same order as the strings in the
|
|
|
|
English file.
|
2002-09-17 07:17:25 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
-t=<target>
|
|
|
|
Specify which target you want the translations/phrases for. Required when
|
|
|
|
-b or -p is used.
|
|
|
|
|
2006-10-18 07:41:00 +00:00
|
|
|
The target can in fact be specified as numerous different strings,
|
|
|
|
separated with colons. This will make genlang to use all the specified
|
|
|
|
strings when searching for a matching phrase.
|
|
|
|
|
2007-08-05 19:19:39 +00:00
|
|
|
-i=<target id>
|
|
|
|
The target id number, needed for -b.
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
-o
|
|
|
|
Voice mode output. Outputs all id: and voice: lines for the given target!
|
|
|
|
|
|
|
|
-v
|
|
|
|
Enables verbose (debug) output.
|
2002-09-16 15:01:38 +00:00
|
|
|
MOO
|
|
|
|
;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# How update works:
|
|
|
|
#
|
|
|
|
# 1) scan the english file, keep the whole <phrase> for each phrase.
|
|
|
|
# 2) read the translated file, for each end of phrase, compare:
|
|
|
|
# A) all source strings, if there's any change there should be a comment about
|
|
|
|
# it output
|
|
|
|
# B) the desc fields
|
|
|
|
#
|
|
|
|
# 3) output the phrase with the comments from above
|
|
|
|
# 4) check which phrases that the translated version didn't have, and spit out
|
|
|
|
# the english version of those
|
|
|
|
#
|
|
|
|
|
2002-09-17 07:17:25 +00:00
|
|
|
my $prefix = $p;
|
2006-04-03 21:11:11 +00:00
|
|
|
my $binary = $b;
|
|
|
|
my $update = $u;
|
2008-08-17 12:25:39 +00:00
|
|
|
my $sortfile = $s;
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
my $english = $e;
|
|
|
|
my $voiceout = $o;
|
|
|
|
|
2008-08-17 12:25:39 +00:00
|
|
|
my $check = ($binary?1:0) + ($prefix?1:0) + ($update?1:0) + ($voiceout?1:0) + ($sortfile?1:0);
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
if($check > 1) {
|
2009-02-27 20:00:45 +00:00
|
|
|
print STDERR "Please use only one of -p, -u, -o, -b and -s\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
if(!$check) {
|
2009-02-27 20:00:45 +00:00
|
|
|
print STDERR "Please use at least one of -p, -u, -o, -b and -s\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
exit;
|
|
|
|
}
|
2007-08-05 19:19:39 +00:00
|
|
|
|
2008-08-17 12:25:39 +00:00
|
|
|
|
|
|
|
if(($binary || $update || $voiceout || $sortfile) && !$english) {
|
2009-02-27 20:00:45 +00:00
|
|
|
print STDERR "Please use -e too when you use -b, -o, -u or -s\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2007-08-05 19:19:39 +00:00
|
|
|
my $target_id = $i;
|
|
|
|
if($binary && !$target_id) {
|
2009-02-27 20:00:45 +00:00
|
|
|
print STDERR "Please specify a target id number (with -i)!\n";
|
2007-08-05 19:19:39 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
my $target = $t;
|
2008-08-17 12:25:39 +00:00
|
|
|
if(!$target && !$update && !$sortfile) {
|
2009-02-27 20:00:45 +00:00
|
|
|
print STDERR "Please specify a target (with -t)!\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
exit;
|
2002-09-17 07:17:25 +00:00
|
|
|
}
|
2011-03-02 00:20:56 +00:00
|
|
|
my @target_parts = split ':', $target;
|
|
|
|
|
2011-03-02 12:30:49 +00:00
|
|
|
my $binpath = "";
|
|
|
|
if ($binary =~ m|(.*)/[^/]+|) {
|
|
|
|
$binpath = $1;
|
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
my $verbose=$v;
|
|
|
|
|
|
|
|
my %id; # string to num hash
|
|
|
|
my @idnum; # num to string array
|
|
|
|
|
2008-08-17 12:25:39 +00:00
|
|
|
my %allphrases; # For sorting - an array of the <phrase> elements
|
2006-04-03 21:11:11 +00:00
|
|
|
my %source; # id string to source phrase hash
|
|
|
|
my %dest; # id string to dest phrase hash
|
|
|
|
my %voice; # id string to voice phrase hash
|
2002-09-17 07:17:25 +00:00
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
my %users =
|
|
|
|
('core' => 0);
|
|
|
|
|
2002-09-17 07:17:25 +00:00
|
|
|
my $input = $ARGV[0];
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
my @m;
|
|
|
|
my $m="blank";
|
|
|
|
|
2007-09-01 20:54:17 +00:00
|
|
|
sub trim {
|
|
|
|
my ($string) = @_;
|
|
|
|
$string =~ s/^\s+//;
|
|
|
|
$string =~ s/\s+$//;
|
|
|
|
return $string;
|
|
|
|
}
|
|
|
|
|
2011-03-02 09:42:51 +00:00
|
|
|
sub blank {
|
|
|
|
# nothing to do
|
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
my %head;
|
|
|
|
sub header {
|
|
|
|
my ($full, $n, $v)=@_;
|
|
|
|
$head{$n}=$v;
|
|
|
|
}
|
|
|
|
|
|
|
|
my %phrase;
|
|
|
|
sub phrase {
|
|
|
|
my ($full, $n, $v)=@_;
|
|
|
|
$phrase{$n}=$v;
|
|
|
|
}
|
|
|
|
|
2009-10-05 11:43:38 +00:00
|
|
|
my %options;
|
|
|
|
sub options {
|
|
|
|
my ($full, $n, $v)=@_;
|
|
|
|
$options{$n}=$v;
|
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
sub parsetarget {
|
|
|
|
my ($debug, $strref, $full, $n, $v)=@_;
|
|
|
|
my $string;
|
|
|
|
my @all= split(" *, *", $n);
|
|
|
|
my $test;
|
|
|
|
for $test (@all) {
|
2011-03-02 00:20:56 +00:00
|
|
|
$test =~ s/\*/.*/g;
|
|
|
|
$test =~ s/\?/./g;
|
2011-03-02 09:42:51 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# print "TEST ($debug) $target for $test\n";
|
2011-03-02 00:20:56 +00:00
|
|
|
for my $part (@target_parts) {
|
2011-03-02 09:42:51 +00:00
|
|
|
if($part =~ /^$test\z/) {
|
2006-10-18 07:41:00 +00:00
|
|
|
$string = $v;
|
|
|
|
# print "MATCH: $test => $v\n";
|
|
|
|
$$strref = $string;
|
|
|
|
return $string;
|
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
my $src;
|
|
|
|
sub source {
|
|
|
|
parsetarget("src", \$src, @_);
|
|
|
|
}
|
|
|
|
|
|
|
|
my $dest;
|
|
|
|
sub dest {
|
|
|
|
parsetarget("dest", \$dest, @_);
|
|
|
|
}
|
|
|
|
|
|
|
|
my $voice;
|
|
|
|
sub voice {
|
|
|
|
parsetarget("voice", \$voice, @_);
|
|
|
|
}
|
|
|
|
|
2011-03-02 12:30:49 +00:00
|
|
|
sub file_is_newer {
|
|
|
|
my ($file1, $file2) = @_;
|
|
|
|
|
|
|
|
my @s1 = stat $file1;
|
|
|
|
my @s2 = stat $file2;
|
|
|
|
|
|
|
|
return 1 if ($s1[9] > $s2[9]);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
my %idmap;
|
|
|
|
my %english;
|
|
|
|
if($english) {
|
2011-03-02 12:30:49 +00:00
|
|
|
readenglish();
|
|
|
|
}
|
|
|
|
|
|
|
|
sub readenglish {
|
2006-04-03 21:11:11 +00:00
|
|
|
# For the cases where the english file needs to be scanned/read, we do
|
|
|
|
# it before we read the translated file. For -b it isn't necessary, but for
|
|
|
|
# -u it is convenient.
|
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
my @idnum = ((0)); # start with a true number
|
|
|
|
my @vidnum = ((0x8000)); # first voice id
|
2011-03-02 12:30:49 +00:00
|
|
|
|
|
|
|
|
2011-03-02 12:47:48 +00:00
|
|
|
if ($binary and file_is_newer("$binpath/english.list", $english)) {
|
2011-03-02 12:30:49 +00:00
|
|
|
open(ENG, "<$binpath/english.list") ||
|
|
|
|
die "Error: can't open $binpath/english.list";
|
|
|
|
while (<ENG>) {
|
|
|
|
my ($user, $id, $value) = split ':', $_;
|
|
|
|
$idmap[$user]{$id} = $value;
|
|
|
|
$english{$id} = 1;
|
|
|
|
}
|
|
|
|
close ENG;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-02-17 23:34:52 +00:00
|
|
|
open(ENG, "<$english") || die "Error: can't open $english";
|
2006-04-03 21:11:11 +00:00
|
|
|
my @phrase;
|
|
|
|
my $id;
|
2007-05-20 13:20:45 +00:00
|
|
|
my $maybeid;
|
2009-03-03 01:38:26 +00:00
|
|
|
my $user;
|
2007-05-20 13:20:45 +00:00
|
|
|
my $withindest;
|
2008-08-17 12:25:39 +00:00
|
|
|
my $numphrases = 0;
|
2009-10-17 05:24:11 +00:00
|
|
|
my $numusers = 1; # core is already in the users map
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
while(<ENG>) {
|
|
|
|
|
|
|
|
# get rid of DOS newlines
|
2011-03-02 12:30:49 +00:00
|
|
|
$_ =~ tr/\r//d;
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
if($_ =~ /^ *\<phrase\>/) {
|
|
|
|
# this is the start of a phrase
|
|
|
|
}
|
2011-03-02 12:30:49 +00:00
|
|
|
elsif($_ =~ /\<\/phrase\>/) {
|
2007-05-20 13:20:45 +00:00
|
|
|
|
|
|
|
# if id is something, when we count and store this phrase
|
|
|
|
if($id) {
|
|
|
|
# voice-only entries get a difference range
|
|
|
|
if($id =~ /^VOICE_/) {
|
|
|
|
# Assign an ID number to this entry
|
2009-10-17 05:24:11 +00:00
|
|
|
$idmap[$user]{$id}=$vidnum[$user];
|
|
|
|
$vidnum[$user]++;
|
2007-05-20 13:20:45 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
# Assign an ID number to this entry
|
2009-10-17 05:24:11 +00:00
|
|
|
$idmap[$user]{$id}=$idnum[$user];
|
|
|
|
$idnum[$user]++;
|
|
|
|
# print STDERR "DEST: bumped idnum to $idnum[$user]\n";
|
2007-05-20 13:20:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# this is the end of a phrase, add it to the english hash
|
|
|
|
$english{$id}=join("", @phrase);
|
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
undef @phrase;
|
2007-05-20 13:20:45 +00:00
|
|
|
$id="";
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
elsif($_ ne "\n") {
|
|
|
|
# gather everything related to this phrase
|
|
|
|
push @phrase, $_;
|
2007-05-20 13:20:45 +00:00
|
|
|
if($_ =~ /^ *\<dest\>/i) {
|
|
|
|
$withindest=1;
|
2007-08-10 22:08:44 +00:00
|
|
|
$deststr="";
|
2007-05-20 13:20:45 +00:00
|
|
|
}
|
|
|
|
elsif($withindest && ($_ =~ /^ *\<\/dest\>/i)) {
|
|
|
|
$withindest=0;
|
2007-08-10 22:08:44 +00:00
|
|
|
|
|
|
|
if($update || ($deststr && ($deststr !~ /^none\z/i))) {
|
|
|
|
# we unconditionally always use all IDs when the "update"
|
|
|
|
# feature is used
|
|
|
|
$id = $maybeid;
|
2007-08-10 23:08:29 +00:00
|
|
|
# print "DEST: use this id $id\n";
|
2007-08-10 22:08:44 +00:00
|
|
|
}
|
|
|
|
else {
|
2007-08-10 23:08:29 +00:00
|
|
|
# print "skip $maybeid for $name\n";
|
2007-08-10 22:08:44 +00:00
|
|
|
}
|
2007-05-20 13:20:45 +00:00
|
|
|
}
|
|
|
|
elsif($withindest && ($_ =~ / *([^:]+): *(.*)/)) {
|
|
|
|
my ($name, $val)=($1, $2);
|
|
|
|
$dest=""; # in case it is left untouched for when the
|
|
|
|
# model name isn't "our"
|
|
|
|
dest($_, $name, $val);
|
|
|
|
|
2007-08-10 22:08:44 +00:00
|
|
|
if($dest) {
|
|
|
|
# Store the current dest string. If this target matches
|
|
|
|
# multiple strings, it will get updated several times.
|
|
|
|
$deststr = $dest;
|
2007-05-20 13:20:45 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if($_ =~ /^ *id: ([^ \t\n]+)/i) {
|
2007-05-20 13:20:45 +00:00
|
|
|
$maybeid=$1;
|
2008-08-17 12:25:39 +00:00
|
|
|
$sortorder{$maybeid}=$numphrases++;
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
2009-03-03 01:38:26 +00:00
|
|
|
if($_ =~ /^ *user: ([^ \t\n]+)/i) {
|
2009-10-17 05:24:11 +00:00
|
|
|
$user = $users{$1};
|
|
|
|
if(!(defined $user)) {
|
|
|
|
$user = ++$numusers;
|
|
|
|
$users{$1} = $user;
|
|
|
|
}
|
2009-03-03 01:38:26 +00:00
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
close(ENG);
|
|
|
|
}
|
|
|
|
|
|
|
|
# a function that compares the english phrase with the translated one.
|
|
|
|
# compare source strings and desc
|
|
|
|
|
|
|
|
# Then output the updated version!
|
|
|
|
sub compare {
|
|
|
|
my ($idstr, $engref, $locref)=@_;
|
|
|
|
my ($edesc, $ldesc);
|
|
|
|
my ($esource, $lsource);
|
|
|
|
my $mode=0;
|
|
|
|
|
|
|
|
for my $l (@$engref) {
|
2007-08-03 20:29:32 +00:00
|
|
|
if($l =~ /^ *#/) {
|
|
|
|
# comment
|
|
|
|
next;
|
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
if($l =~ /^ *desc: (.*)/) {
|
|
|
|
$edesc=$1;
|
|
|
|
}
|
|
|
|
elsif($l =~ / *\<source\>/i) {
|
|
|
|
$mode=1;
|
|
|
|
}
|
|
|
|
elsif($mode) {
|
|
|
|
if($l =~ / *\<\/source\>/i) {
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
$esource .= "$l\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
my @show;
|
|
|
|
my @source;
|
|
|
|
|
|
|
|
$mode = 0;
|
|
|
|
for my $l (@$locref) {
|
|
|
|
if($l =~ /^ *desc: (.*)/) {
|
|
|
|
$ldesc=$1;
|
2007-09-01 20:54:17 +00:00
|
|
|
if(trim($edesc) ne trim($ldesc)) {
|
2006-04-03 21:11:11 +00:00
|
|
|
$l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n";
|
|
|
|
}
|
|
|
|
push @show, $l;
|
2011-03-02 09:42:51 +00:00
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
elsif($l =~ / *\<source\>/i) {
|
|
|
|
$mode=1;
|
|
|
|
push @show, $l;
|
|
|
|
}
|
|
|
|
elsif($mode) {
|
|
|
|
if($l =~ / *\<\/source\>/i) {
|
|
|
|
$mode = 0;
|
|
|
|
print @show;
|
2007-09-01 20:54:17 +00:00
|
|
|
if(trim($esource) ne trim($lsource)) {
|
2006-04-03 21:11:11 +00:00
|
|
|
print "### The <source> section differs from the english!\n",
|
|
|
|
"### the previously used one is commented below:\n";
|
|
|
|
for(split("\n", $lsource)) {
|
|
|
|
print "### $_\n";
|
|
|
|
}
|
|
|
|
print $esource;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print $lsource;
|
|
|
|
}
|
|
|
|
undef @show; # start over
|
|
|
|
|
|
|
|
push @show, $l;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$lsource .= "$l";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
push @show, $l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print @show;
|
|
|
|
}
|
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
my @idcount; # counter for lang ID numbers
|
|
|
|
my @voiceid; # counter for voice-only ID numbers
|
|
|
|
|
2009-10-18 00:56:42 +00:00
|
|
|
for (keys %users) {
|
2009-10-17 05:24:11 +00:00
|
|
|
push @idcount, 0;
|
2010-05-26 03:51:13 +00:00
|
|
|
push @voiceid, 0x8001;
|
2009-10-17 05:24:11 +00:00
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Now start the scanning of the selected language string
|
|
|
|
#
|
|
|
|
|
2008-02-17 23:34:52 +00:00
|
|
|
open(LANG, "<$input") || die "Error: couldn't read language file named $input\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
my @phrase;
|
2008-08-11 21:36:00 +00:00
|
|
|
my $header = 1;
|
2009-10-05 11:43:38 +00:00
|
|
|
my $langoptions = 0;
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
while(<LANG>) {
|
|
|
|
|
|
|
|
$line++;
|
|
|
|
|
|
|
|
# get rid of DOS newlines
|
2011-03-02 12:30:49 +00:00
|
|
|
$_ =~ tr/\r//d;
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
if($_ =~ /^( *\#|[ \t\n\r]*\z)/) {
|
2008-08-11 21:36:00 +00:00
|
|
|
# comment or empty line - output it if it's part of the header
|
2008-08-17 12:25:39 +00:00
|
|
|
if ($header and ($update || $sortfile)) {
|
2008-08-11 21:36:00 +00:00
|
|
|
print($_);
|
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
next;
|
|
|
|
}
|
2008-08-11 21:36:00 +00:00
|
|
|
$header = 0;
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
my $ll = $_;
|
2002-09-17 07:17:25 +00:00
|
|
|
|
2006-04-19 11:03:37 +00:00
|
|
|
# print "M: $m\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
push @phrase, $ll;
|
|
|
|
|
|
|
|
# this is an XML-lookalike tag
|
2006-04-19 11:03:37 +00:00
|
|
|
if (/^(<|[^\"<]+<)([^>]*)>/) {
|
|
|
|
my $part = $2;
|
|
|
|
# print "P: $part\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
if($part =~ /^\//) {
|
|
|
|
# this was a closing tag
|
|
|
|
|
|
|
|
if($part eq "/phrase") {
|
|
|
|
# closing the phrase
|
|
|
|
|
|
|
|
my $idstr = $phrase{'id'};
|
|
|
|
my $idnum;
|
|
|
|
|
2007-08-02 22:09:00 +00:00
|
|
|
if($binary && !$english{$idstr}) {
|
|
|
|
# $idstr doesn't exist for english, skip it\n";
|
|
|
|
}
|
|
|
|
elsif($dest =~ /^none\z/i) {
|
2006-04-06 09:08:11 +00:00
|
|
|
# "none" as dest (without quotes) means that this entire
|
|
|
|
# phrase is to be ignored
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
2008-08-17 12:25:39 +00:00
|
|
|
elsif($sortfile) {
|
|
|
|
$allphrases{$idstr}=join('',@phrase);
|
|
|
|
}
|
2006-10-28 17:05:42 +00:00
|
|
|
elsif(!$update) {
|
|
|
|
# we don't do the fully detailed analysis when we "update"
|
|
|
|
# since we don't do it for a particular target etc
|
|
|
|
|
2006-04-06 09:08:11 +00:00
|
|
|
# allow the keyword 'deprecated' to be used on dest and
|
|
|
|
# voice strings to mark that as deprecated. It will then
|
|
|
|
# be replaced with "".
|
|
|
|
|
|
|
|
$dest =~ s/^deprecate(|d)\z/\"\"/i;
|
|
|
|
$voice =~ s/^deprecate(|d)\z/\"\"/i;
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2006-04-27 22:49:36 +00:00
|
|
|
# basic syntax error alerts, if there are no quotes we
|
|
|
|
# will assume an empty string was intended
|
|
|
|
if($dest !~ /^\"/) {
|
2008-02-17 23:42:38 +00:00
|
|
|
print STDERR "$input:$line:1: warning: dest before line lacks quotes ($dest)!\n";
|
2006-04-27 22:49:36 +00:00
|
|
|
$dest='""';
|
2006-04-06 09:08:11 +00:00
|
|
|
}
|
2006-04-27 22:49:36 +00:00
|
|
|
if($src !~ /^\"/) {
|
2008-02-17 23:42:38 +00:00
|
|
|
print STDERR "$input:$line:1: warning: source before line lacks quotes ($src)!\n";
|
2006-04-27 22:49:36 +00:00
|
|
|
$src='""';
|
2006-04-06 09:08:11 +00:00
|
|
|
}
|
2008-02-17 23:34:52 +00:00
|
|
|
if($voice !~ /^\"/ and $voice !~ /^none\z/i) {
|
2008-02-17 23:42:38 +00:00
|
|
|
print STDERR "$input:$line:1: warning: voice before line lacks quotes ($voice)!\n";
|
2006-04-27 22:49:36 +00:00
|
|
|
$voice='""';
|
2006-04-06 09:08:11 +00:00
|
|
|
}
|
2008-11-08 22:04:28 +00:00
|
|
|
if($dest eq '""' && $phrase{'desc'} !~ /deprecated/i && $idstr !~ /^VOICE/) {
|
|
|
|
print STDERR "$input:$line:1: warning: empty dest before line in non-deprecated phrase!\n";
|
|
|
|
}
|
2009-03-03 01:38:26 +00:00
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
my $userstr = trim($phrase{'user'});
|
|
|
|
my $user = $users{$userstr};
|
|
|
|
if ($userstr eq "") {
|
|
|
|
print STDERR "$input:$line:1: warning: missing user!\n";
|
|
|
|
$user = $users{"core"};
|
|
|
|
}
|
|
|
|
elsif(!(defined $user)) {
|
|
|
|
if($english) {
|
|
|
|
print STDERR "$input:$line:1: warning: user was not found in $english!\n";
|
|
|
|
$user = keys %users; # set to an invalid user so it won't be added
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# we found a new user, add it to the usermap
|
|
|
|
$user = ++$numusers;
|
|
|
|
$users{$userstr} = $user;
|
|
|
|
}
|
2009-03-03 01:38:26 +00:00
|
|
|
}
|
2006-04-06 09:08:11 +00:00
|
|
|
|
2006-10-28 17:05:42 +00:00
|
|
|
# Use the ID name to figure out which id number range we
|
|
|
|
# should use for this phrase. Voice-only strings are
|
|
|
|
# separated.
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
if($idstr =~ /^VOICE/) {
|
2009-10-17 05:24:11 +00:00
|
|
|
$idnum = $voiceid[$user]++;
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-10-17 05:24:11 +00:00
|
|
|
$idnum = $idcount[$user]++;
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$id{$idstr} = $idnum;
|
2009-10-17 05:24:11 +00:00
|
|
|
$idnum[$user][$idnum]=$idstr;
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
$source{$idstr}=$src;
|
|
|
|
$dest{$idstr}=$dest;
|
|
|
|
$voice{$idstr}=$voice;
|
2007-08-10 23:08:29 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
if($verbose) {
|
|
|
|
print "id: $phrase{id} ($idnum)\n";
|
|
|
|
print "source: $src\n";
|
|
|
|
print "dest: $dest\n";
|
|
|
|
print "voice: $voice\n";
|
2009-03-03 01:38:26 +00:00
|
|
|
print "user: $user\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
undef $src;
|
|
|
|
undef $dest;
|
|
|
|
undef $voice;
|
2009-03-03 01:38:26 +00:00
|
|
|
undef $user;
|
2006-04-03 21:11:11 +00:00
|
|
|
undef %phrase;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($update) {
|
|
|
|
my $e = $english{$idstr};
|
|
|
|
|
|
|
|
if($e) {
|
|
|
|
# compare original english with this!
|
|
|
|
my @eng = split("\n", $english{$idstr});
|
|
|
|
|
|
|
|
compare($idstr, \@eng, \@phrase);
|
|
|
|
|
|
|
|
$english{$idstr}=""; # clear it
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print "### $idstr: The phrase is not used. Skipped\n";
|
|
|
|
}
|
|
|
|
}
|
2009-11-05 22:18:29 +00:00
|
|
|
undef @phrase;
|
2006-04-03 21:11:11 +00:00
|
|
|
} # end of </phrase>
|
2009-10-05 11:43:38 +00:00
|
|
|
elsif($part eq "/options") {
|
|
|
|
# closing the options
|
|
|
|
if ($options{'rtl'}) {
|
|
|
|
$langoptions |= $LANGUAGE_FLAG_RTL;
|
|
|
|
}
|
|
|
|
} # end of </options>
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# starts with a slash, this _ends_ this section
|
|
|
|
$m = pop @m; # get back old value, the previous level's tag
|
|
|
|
next;
|
|
|
|
} # end of tag close
|
|
|
|
|
|
|
|
# This is an opening (sub) tag
|
|
|
|
|
|
|
|
push @m, $m; # store old value
|
2006-04-19 11:03:37 +00:00
|
|
|
$m = $part;
|
2006-04-03 21:11:11 +00:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(/^ *([^:]+): *(.*)/) {
|
|
|
|
my ($name, $val)=($1, $2);
|
|
|
|
&$m($_, $name, $val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close(LANG);
|
|
|
|
|
|
|
|
if($update) {
|
|
|
|
my $any=0;
|
|
|
|
for(keys %english) {
|
|
|
|
if($english{$_}) {
|
|
|
|
print "###\n",
|
|
|
|
"### This phrase below was not present in the translated file\n",
|
|
|
|
"<phrase>\n";
|
|
|
|
print $english{$_};
|
|
|
|
print "</phrase>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-17 12:25:39 +00:00
|
|
|
if ($sortfile) {
|
|
|
|
for(sort { $sortorder{$a} <=> $sortorder{$b} } keys %allphrases) {
|
|
|
|
print $allphrases{$_};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
if($prefix) {
|
|
|
|
# We create a .c and .h file
|
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
open(HFILE_CORE, ">$prefix/lang.h") ||
|
2009-03-02 06:13:18 +00:00
|
|
|
die "Error: couldn't create file $prefix/lang.h\n";
|
2009-10-17 05:24:11 +00:00
|
|
|
open(CFILE_CORE, ">$prefix/lang_core.c") ||
|
2009-03-02 06:13:18 +00:00
|
|
|
die "Error: couldn't create file $prefix/lang_core.c\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2009-02-04 20:59:27 +00:00
|
|
|
# get header file name
|
2009-03-02 06:13:18 +00:00
|
|
|
$headername = "$prefix/lang.h";
|
2009-02-04 20:59:27 +00:00
|
|
|
$headername =~ s/(.*\/)*//;
|
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
print HFILE_CORE <<MOO
|
2006-10-18 07:41:00 +00:00
|
|
|
/* This file was automatically generated using genlang */
|
2002-09-16 15:01:38 +00:00
|
|
|
/*
|
|
|
|
* The str() macro/functions is how to access strings that might be
|
2002-09-20 06:37:25 +00:00
|
|
|
* translated. Use it like str(MACRO) and expect a string to be
|
2002-09-16 15:01:38 +00:00
|
|
|
* returned!
|
|
|
|
*/
|
2002-09-17 07:17:25 +00:00
|
|
|
#define str(x) language_strings[x]
|
|
|
|
|
2005-01-19 21:43:15 +00:00
|
|
|
/* this is the array for holding the string pointers.
|
|
|
|
It will be initialized at runtime. */
|
2002-09-17 07:17:25 +00:00
|
|
|
extern unsigned char *language_strings[];
|
2005-07-31 21:58:49 +00:00
|
|
|
/* this contains the concatenation of all strings, separated by \\0 chars */
|
2009-10-18 00:56:42 +00:00
|
|
|
extern const unsigned char core_language_builtin[];
|
2002-09-17 07:17:25 +00:00
|
|
|
|
2002-09-20 06:37:25 +00:00
|
|
|
/* The enum below contains all available strings */
|
2006-04-03 21:11:11 +00:00
|
|
|
enum \{
|
2002-09-17 07:17:25 +00:00
|
|
|
MOO
|
|
|
|
;
|
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
print CFILE_CORE <<MOO
|
|
|
|
/* This file was automatically generated using genlang, the strings come
|
2002-09-17 07:17:25 +00:00
|
|
|
from "$input" */
|
2005-01-19 21:43:15 +00:00
|
|
|
|
2009-02-04 20:59:27 +00:00
|
|
|
#include "$headername"
|
2002-09-17 07:17:25 +00:00
|
|
|
|
2005-01-19 21:43:15 +00:00
|
|
|
unsigned char *language_strings[LANG_LAST_INDEX_IN_ARRAY];
|
2009-10-18 00:56:42 +00:00
|
|
|
const unsigned char core_language_builtin[] =
|
2002-09-16 15:01:38 +00:00
|
|
|
MOO
|
2006-04-03 21:11:11 +00:00
|
|
|
;
|
2002-09-16 15:01:38 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# Output the ID names for the enum in the header file
|
|
|
|
my $i;
|
2009-10-18 00:56:42 +00:00
|
|
|
for $i (0 .. $idcount[$users{"core"}]-1) {
|
|
|
|
my $name=$idnum[$users{"core"}][$i]; # get the ID name
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2011-03-02 12:30:49 +00:00
|
|
|
$name =~ tr/\"//d; # cut off the quotes
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2009-10-18 00:56:42 +00:00
|
|
|
printf HFILE_CORE (" %s, /* %d */\n", $name, $i);
|
2002-09-16 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# Output separation marker for last string ID and the upcoming voice IDs
|
2002-09-16 15:01:38 +00:00
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
print HFILE_CORE <<MOO
|
2006-04-03 21:11:11 +00:00
|
|
|
LANG_LAST_INDEX_IN_ARRAY, /* this is not a string, this is a marker */
|
|
|
|
/* --- below this follows voice-only strings --- */
|
|
|
|
VOICEONLY_DELIMITER = 0x8000,
|
|
|
|
MOO
|
|
|
|
;
|
2002-10-11 22:01:24 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# Output the ID names for the enum in the header file
|
2010-05-26 03:51:13 +00:00
|
|
|
for $i (0x8001 .. ($voiceid[$users{"core"}]-1)) {
|
2009-10-17 05:24:11 +00:00
|
|
|
my $name=$idnum[$users{"core"}][$i]; # get the ID name
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2011-03-02 12:30:49 +00:00
|
|
|
$name =~ tr/\"//d; # cut off the quotes
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2010-05-26 03:11:00 +00:00
|
|
|
printf HFILE_CORE (" %s, /* 0x%x */\n", $name, $i);
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
2002-09-16 15:01:38 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# Output end of enum
|
2009-10-17 05:24:11 +00:00
|
|
|
print HFILE_CORE "\n};\n/* end of generated enum list */\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
# Output the target phrases for the source file
|
2009-10-18 00:56:42 +00:00
|
|
|
for $i (0 .. $idcount[$users{"core"}]-1) {
|
|
|
|
my $name=$idnum[$users{"core"}][$i]; # get the ID
|
2006-04-03 21:11:11 +00:00
|
|
|
my $dest = $dest{$name}; # get the destination phrase
|
|
|
|
|
|
|
|
$dest =~ s:\"$:\\0\":; # insert a \0 before the second quote
|
2002-09-17 07:17:25 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
if(!$dest) {
|
|
|
|
# this is just to be on the safe side
|
|
|
|
$dest = '"\0"';
|
2002-09-16 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
printf CFILE_CORE (" %s\n", $dest);
|
2002-09-16 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
# Output end of string chunk
|
2009-10-17 05:24:11 +00:00
|
|
|
print CFILE_CORE <<MOO
|
2006-04-03 21:11:11 +00:00
|
|
|
;
|
|
|
|
/* end of generated string list */
|
|
|
|
MOO
|
|
|
|
;
|
2002-09-17 07:17:25 +00:00
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
close(HFILE_CORE);
|
|
|
|
close(CFILE_CORE);
|
2006-04-03 21:11:11 +00:00
|
|
|
} # end of the c/h file generation
|
|
|
|
elsif($binary) {
|
|
|
|
# Creation of a binary lang file was requested
|
|
|
|
|
|
|
|
# We must first scan the english file to get the correct order of the id
|
|
|
|
# numbers used there, as that is what sets the id order for all language
|
|
|
|
# files. The english file is scanned before the translated file was
|
|
|
|
# scanned.
|
|
|
|
|
2008-02-17 23:34:52 +00:00
|
|
|
open(OUTF, ">$binary") or die "Error: Can't create $binary";
|
2006-04-03 21:11:11 +00:00
|
|
|
binmode OUTF;
|
2009-10-05 11:43:38 +00:00
|
|
|
printf OUTF ("%c%c%c%c", $LANGUAGE_COOKIE, $LANGUAGE_VERSION, $target_id,
|
|
|
|
$langoptions); # magic lang file header
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2009-10-18 00:56:42 +00:00
|
|
|
# output the number of strings for each user
|
|
|
|
my $foffset = $HEADER_SIZE + $SUBHEADER_SIZE * keys(%users);
|
|
|
|
for (keys %users) {
|
|
|
|
my $size;
|
|
|
|
for $n (0 .. $idcount[$_]-1) {
|
|
|
|
$size += length(trim($dest{$idnum[$_][$n]})) + 1;
|
|
|
|
}
|
|
|
|
printf OUTF ("%c%c%c%c%c%c", ($idcount[$_] >> 8), ($idcount[$_] & 0xff),
|
|
|
|
($size >> 8), ($size & 0xff), ($foffset >> 8), ($foffset & 0xff));
|
|
|
|
$foffset += $size;
|
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2009-10-18 00:56:42 +00:00
|
|
|
for (keys %users) {
|
|
|
|
# loop over the target phrases
|
|
|
|
for $n (0 .. $idcount[$_]-1) {
|
|
|
|
my $name=$idnum[$_][$n]; # get the ID
|
|
|
|
my $dest = $dest{$name}; # get the destination phrase
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2009-10-18 00:56:42 +00:00
|
|
|
if($dest) {
|
|
|
|
$dest =~ s/^\"(.*)\"\s*$/$1/g; # cut off quotes
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2009-10-18 00:56:42 +00:00
|
|
|
# Now, make sure we get the number from the english sort order:
|
|
|
|
$idnum = $idmap[$_]{$name};
|
|
|
|
|
|
|
|
printf OUTF ("%c%c%s\x00", ($idnum>>8), ($idnum&0xff), $dest);
|
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
}
|
2004-04-03 20:52:24 +00:00
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
elsif($voiceout) {
|
|
|
|
# voice output requested, display id: and voice: strings in a v1-like
|
|
|
|
# fashion
|
2004-04-03 20:52:24 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
my @engl;
|
|
|
|
|
|
|
|
# This loops over the strings in the translated language file order
|
2009-10-17 05:24:11 +00:00
|
|
|
my @ids = ((0 .. ($idcount[$users{"core"}]-1)));
|
|
|
|
push @ids, (0x8000 .. ($voiceid[$users{"core"}]-1));
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
#for my $id (@ids) {
|
|
|
|
# print "$id\n";
|
|
|
|
#}
|
|
|
|
|
|
|
|
for $i (@ids) {
|
2009-10-17 05:24:11 +00:00
|
|
|
my $name=$idnum[$users{"core"}][$i]; # get the ID
|
2006-04-03 21:11:11 +00:00
|
|
|
my $dest = $voice{$name}; # get the destination voice string
|
2004-04-03 20:52:24 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
if($dest) {
|
|
|
|
$dest =~ s/^\"(.*)\"\s*$/$1/g; # cut off quotes
|
|
|
|
|
|
|
|
# Now, make sure we get the number from the english sort order:
|
2009-10-17 05:24:11 +00:00
|
|
|
$idnum = $idmap[$users{"core"}]{$name};
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2007-08-10 23:08:29 +00:00
|
|
|
if(length($idnum)) {
|
|
|
|
$engl[$idnum] = $i;
|
2006-04-03 21:11:11 +00:00
|
|
|
|
2007-08-10 23:08:29 +00:00
|
|
|
#print "Input index $i output index $idnum\n";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# not used, mark it so
|
|
|
|
$engl[$i] = -1
|
|
|
|
}
|
2006-04-03 21:11:11 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for my $i (@ids) {
|
|
|
|
|
|
|
|
my $o = $engl[$i];
|
|
|
|
|
2007-08-10 23:08:29 +00:00
|
|
|
if(($o < 0) || !length($o)) {
|
|
|
|
print "#$i\nid: NOT_USED_$i\nvoice: \"\"\n";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2009-10-17 05:24:11 +00:00
|
|
|
my $name=$idnum[$users{"core"}][$o]; # get the ID
|
2006-04-03 21:11:11 +00:00
|
|
|
my $dest = $voice{$name}; # get the destination voice string
|
|
|
|
|
2007-08-10 23:08:29 +00:00
|
|
|
print "#$i ($o)\nid: $name\nvoice: $dest\n";
|
2006-04-03 21:11:11 +00:00
|
|
|
}
|
|
|
|
|
2004-04-03 20:52:24 +00:00
|
|
|
}
|
2002-09-17 07:17:25 +00:00
|
|
|
|
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
if($verbose) {
|
2009-10-18 00:56:42 +00:00
|
|
|
my $num_str = 0;
|
|
|
|
|
|
|
|
for (keys %users) {
|
|
|
|
$num_str += $idcount[$_];
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("%d ID strings scanned\n", $num_str);
|
2002-09-17 07:17:25 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
print "* head *\n";
|
|
|
|
for(keys %head) {
|
|
|
|
printf "$_: %s\n", $head{$_};
|
|
|
|
}
|
|
|
|
}
|
2002-10-14 08:49:25 +00:00
|
|
|
|
2011-03-02 12:47:48 +00:00
|
|
|
if ($binary and !-r "$binpath/english.list") {
|
2011-03-02 12:30:49 +00:00
|
|
|
open(ENGLIST, ">$binpath/english.list") ||
|
|
|
|
die "Failed creating $binpath/english.list";
|
|
|
|
for my $user (keys %users) {
|
|
|
|
for my $id (keys %{$idmap[$user]}) {
|
|
|
|
print ENGLIST "$user:$id:$idmap[$user]{$id}\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close ENGLIST;
|
|
|
|
}
|