From 9ce4aee8809f71c97c870e74bbdddc6d33e01a71 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 9 Dec 2010 14:14:06 +0100 Subject: [PATCH] =?utf8?q?Auch=20nach=20weiteren=20=C3=9Cbersetzungen=20su?= =?utf8?q?chen,=20wenn=20=C3=9Cbersetzung=20existiert=20aber=20leer=20ist?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Helper/TranslatedAttributes.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/SL/DB/Helper/TranslatedAttributes.pm b/SL/DB/Helper/TranslatedAttributes.pm index b0b1c2e6c..dbb3ae167 100644 --- a/SL/DB/Helper/TranslatedAttributes.pm +++ b/SL/DB/Helper/TranslatedAttributes.pm @@ -12,13 +12,16 @@ use Carp; sub translated_attribute { my ($self, $attribute, $language_id, $verbatim) = @_; - $language_id = _check($self, $attribute, $language_id, $verbatim); - my $translation = _find_translation($self, $attribute, $language_id, 0); - $translation ||= _find_translation($self, $attribute, undef, 0) unless $verbatim; + $language_id = _check($self, $attribute, $language_id, $verbatim); + my $translation_obj = _find_translation($self, $attribute, $language_id, 0); + my $translation = $translation_obj ? $translation_obj->translation : ''; - return $translation ? $translation->translation - : $verbatim ? undef - : $self->$attribute; + return $translation if $verbatim || $translation; + + $translation_obj = _find_translation($self, $attribute, undef, 0); + $translation = $translation_obj ? $translation_obj->translation : ''; + + return $translation || $self->$attribute; } sub save_attribute_translation { -- 2.20.1