diff options
author | Angelo Naselli <anaselli@linux.it> | 2016-01-02 23:25:35 +0100 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2016-01-02 23:25:35 +0100 |
commit | 8f533877343e8ff6706707d7bd9e77b7158b37cf (patch) | |
tree | 6c59c1e40708439fd434a8511aac1081b2e2085e | |
parent | 62e649c81e41cf0f4cdfd54ac1b00deaa40c9f23 (diff) | |
download | manatools-8f533877343e8ff6706707d7bd9e77b7158b37cf.tar manatools-8f533877343e8ff6706707d7bd9e77b7158b37cf.tar.gz manatools-8f533877343e8ff6706707d7bd9e77b7158b37cf.tar.bz2 manatools-8f533877343e8ff6706707d7bd9e77b7158b37cf.tar.xz manatools-8f533877343e8ff6706707d7bd9e77b7158b37cf.zip |
try to return a value as a string if no xml:lang is present
-rw-r--r-- | lib/ManaTools/MainDisplay.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ManaTools/MainDisplay.pm b/lib/ManaTools/MainDisplay.pm index a3340c03..5be17d01 100644 --- a/lib/ManaTools/MainDisplay.pm +++ b/lib/ManaTools/MainDisplay.pm @@ -593,11 +593,17 @@ sub _localizedValue { return if !defined($hash->{$key}); + if (ref($hash->{$key}) ne "HASH") { + $self->logger()->W($self->loc()->N("Bad configuration file, %s has not xml:lang attribute, guessing it is a string", $key)); + # Force array is set for "title" + return $hash->{$key}[0]; + } + my @lang = I18N::LangTags::Detect::detect(); # Adding default value as English (en) push @lang, 'en'; foreach my $l ( @lang ) { - return $hash->{$key}->{$l} if $hash->{$key}->{$l}; + return $hash->{$key}->{$l} if defined($hash->{$key}->{$l}); } return; |