Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'zf2140' of https://github.com/cgdangelo/zf2 into hotfix…
Browse files Browse the repository at this point in the history
…/zf2-140
  • Loading branch information
weierophinney committed Jan 12, 2012
2 parents a9d9490 + 8331d03 commit 4e62a6d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Helper/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function __invoke($messageid = null)
public function setTranslator($translator)
{
if ($translator instanceof TranslationAdapter) {
$this->translator = $translate;
$this->translator = $translator;
} else if ($translator instanceof Translation) {
$this->translator = $translator->getAdapter();
} else {
Expand Down
20 changes: 20 additions & 0 deletions test/Helper/TranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,24 @@ public function testTranslationWithoutTranslator()
$result = $this->helper->__invoke("test %1\$s", "100");
$this->assertEquals('test 100', $result);
}

/**
* @group ZF2-140
*/
public function testSetTranslatorWithTranslationAdapter()
{
$trans = new Translator\Adapter\ArrayAdapter(array('one' => 'eins', "two %1\$s" => "zwei %1\$s",
"three %1\$s %2\$s" => "drei %1\$s %2\$s", 'vier%ig' => 'four%'), 'de');
$this->helper->setTranslator($trans);
}

/**
* @group ZF2-140
*/
public function testSetTranslatorWithTranslation()
{
$trans = new Translator\Translator('arrayAdapter', array('one' => 'eins', "two %1\$s" => "zwei %1\$s",
"three %1\$s %2\$s" => "drei %1\$s %2\$s", 'vier%ig' => 'four%'), 'de');
$this->helper->setTranslator($trans);
}
}

0 comments on commit 4e62a6d

Please sign in to comment.