From 79dea6ab7b56149b02d2910ea56f26f13afea291 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 17 Jul 2015 14:46:39 +0200 Subject: [PATCH] =?utf8?q?Locale:=20zus=C3=A4tzliche=20Locales=20parsen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Locale.pm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/SL/Locale.pm b/SL/Locale.pm index 8495553e8..4198a339b 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -80,11 +80,27 @@ sub _init { $self->{countrycode} = $country; if ($country && -d "locale/$country") { - local *IN; - if (open(IN, "<", "locale/$country/all")) { - my $code = join("", ); + if (open my $in, "<", "locale/$country/all") { + local $/ = undef; + my $code = <$in>; eval($code); - close(IN); + close($in); + } + + if (-d "locale/$country/more") { + opendir my $dh, "locale/$country/more" or die "can't open locale/$country/more: $!"; + my @files = sort grep -f "locale/$country/more/$_", readdir $dh; + close $dh; + + for my $file (@files) { + if (open my $in, "<", "locale/$country/more/$file") { + local $/ = undef; + my $code = <$file>; + eval($code); + close($in); + $self->{texts}{$_} = $self->{more_texts}{$_} for keys %{ $self->{more_texts} }; + } + } } } -- 2.20.1