From 7eacc5adf5c987ac10c7103182ea12586378f243 Mon Sep 17 00:00:00 2001 From: Vincent LEFORT Date: Mon, 6 Jan 2014 16:42:37 +0100 Subject: [PATCH] Fix Empty translations with Qt files --- .../Component/Translation/Loader/QtFileLoader.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Translation/Loader/QtFileLoader.php b/src/Symfony/Component/Translation/Loader/QtFileLoader.php index d64494b81c78..dbb56daec618 100644 --- a/src/Symfony/Component/Translation/Loader/QtFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/QtFileLoader.php @@ -53,11 +53,15 @@ public function load($resource, $locale, $domain = 'messages') if ($nodes->length == 1) { $translations = $nodes->item(0)->nextSibling->parentNode->parentNode->getElementsByTagName('message'); foreach ($translations as $translation) { - $catalogue->set( - (string) $translation->getElementsByTagName('source')->item(0)->nodeValue, - (string) $translation->getElementsByTagName('translation')->item(0)->nodeValue, - $domain - ); + $translationValue = (string) $translation->getElementsByTagName('translation')->item(0)->nodeValue; + + if (!empty($translationValue)) { + $catalogue->set( + (string) $translation->getElementsByTagName('source')->item(0)->nodeValue, + $translationValue, + $domain + ); + } $translation = $translation->nextSibling; } $catalogue->addResource(new FileResource($resource));