Skip to content

Commit

Permalink
Fixed for allowing empty translation.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemens-tolboom committed May 19, 2012
1 parent 58b9245 commit dd60166
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Translation/Loader/PoFileLoader.php
Expand Up @@ -105,6 +105,6 @@ private function parse($resource)
}
fclose($stream);

return array_filter($messages);
return $messages;
}
}
Expand Up @@ -54,4 +54,15 @@ public function testLoadDoesNothingIfEmpty()
$this->assertEquals('en', $catalogue->getLocale());
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
}

public function testLoadEmptyTranslation()
{
$loader = new PoFileLoader();
$resource = __DIR__.'/../fixtures/empty-translation.po';
$catalogue = $loader->load($resource, 'en', 'domain1');

$this->assertEquals(array('foo' => ''), $catalogue->all('domain1'));
$this->assertEquals('en', $catalogue->getLocale());
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
}
}
@@ -0,0 +1,3 @@
msgid "foo"
msgstr ""

0 comments on commit dd60166

Please sign in to comment.