From 71374108ac2e494d2d74986969c5aea8ff863906 Mon Sep 17 00:00:00 2001 From: Miguel Zapico Date: Mon, 25 Feb 2008 23:55:20 +0000 Subject: [PATCH] Solved bug #11153, units description now defaults to English if missing --- data/tools/unit_tree/units.pl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/data/tools/unit_tree/units.pl b/data/tools/unit_tree/units.pl index 768963c0142..13afcae28ca 100755 --- a/data/tools/unit_tree/units.pl +++ b/data/tools/unit_tree/units.pl @@ -36,9 +36,9 @@ my $source = 1; # If translating, and not from the source, remove the comment on the following line #use Locale::Maketext::Gettext; # This option will determine if the attack images are copied, and the images units are copied and colorized -my $images = 1; +my $images = 0; # This option will determine if the html report on made animations is generated -my $animations = 1; +my $animations = 0; # This is the version number that will appear on the unit trees my $version = 'trunk'; # These option will try to process the user made Eras @@ -828,7 +828,7 @@ sub TranslateUnits { } foreach $country (@countries) { - my ($flag, $base, $unit_base, %dict); + my ($flag, $base, $unit_base, %dict, %unit_desc_tr); $country =~ s(.*\/)(); # Take only the country $country =~ s(.po$)(); # If it is the source, we need to stript also the extension unless (-e "$html_dir/$country") {mkdir "$html_dir/$country" or die "$country directory cannot be created: $!\n";}; @@ -856,7 +856,7 @@ sub TranslateUnits { $flag = 0; $desc =~ s/"//g; $desc =~ s/(\\n)+/
/g; - $unit_desc{$unit_file} = $desc if length($desc)>50; + $unit_desc_tr{$unit_file} = $desc if length($desc)>50; $desc=''; } @@ -913,7 +913,13 @@ sub TranslateUnits { $line =~ s/>([^<]+)$dict{$1}' . $unit_desc{$unit_id_to_file{$id}} . "

\n" if $line =~ (/smaller">[^<]/); + if ($line =~ /smaller">[^<]/) { + if ($unit_desc_tr{$unit_id_to_file{$id}}) { + $line = '

' . $unit_desc_tr{$unit_id_to_file{$id}} . "

\n"; + } else { + $line = '

' . $unit_desc{$unit_id_to_file{$id}} . "

\n"; + } + } $line =~ s///g; # Remove comments }