From 8f533877343e8ff6706707d7bd9e77b7158b37cf Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Sat, 2 Jan 2016 23:25:35 +0100 Subject: try to return a value as a string if no xml:lang is present --- lib/ManaTools/MainDisplay.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/ManaTools/MainDisplay.pm') 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; -- cgit v1.2.1