From fd8f2b0812d1d55cf7d78c2f4a1c31efa3fbc47e Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Sat, 28 Feb 2004 14:59:23 +0000 Subject: load_mo: first perform a lookup on mo's for all possible langs, will prevent from downloading each time another time the mo file (fr_FR comes first, is not here, everything including fr gets removed, fr_FR is non-existent, and then fr is downloaded again) --- perl-install/lang.pm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'perl-install/lang.pm') diff --git a/perl-install/lang.pm b/perl-install/lang.pm index 4288530c3..45dbf5e78 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -1048,17 +1048,18 @@ sub load_mo { $lang ||= $ENV{LANGUAGE} || $ENV{LC_ALL} || $ENV{LC_MESSAGES} || $ENV{LANG}; - foreach (split ':', $lang) { - my $f = "$localedir/$_/$suffix"; - -s $f and return $_; + my @possible_langs = map { { name => $_, mofile => "$localedir/$_/$suffix" } } split ':', $lang; - if ($::isInstall && common::usingRamdisk()) { - #- cleanup - eval { rm_rf($localedir) }; - eval { mkdir_p(dirname("$localedir/$_/$suffix")) }; - install_any::getAndSaveFile("$localedir/$_/$suffix"); + -s $_->{mofile} and return $_->{name} foreach @possible_langs; - -s $f and return $_; + if ($::isInstall && common::usingRamdisk()) { + foreach (@possible_langs) { + #- cleanup + eval { rm_rf($localedir) }; + eval { mkdir_p(dirname($_->{mofile})) }; + + install_any::getAndSaveFile($_->{mofile}); + -s $_->{mofile} and return $_->{name}; } } ''; -- cgit v1.2.1