Skip to content

Commit

Permalink
[Translator] Fix Empty translations with Qt files
Browse files Browse the repository at this point in the history
  • Loading branch information
vlefort committed Jan 6, 2014
1 parent 8cd8ec0 commit 1c220be
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Symfony/Component/Translation/Loader/QtFileLoader.php
Expand Up @@ -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));
Expand Down

0 comments on commit 1c220be

Please sign in to comment.