Skip to content

Commit

Permalink
Adding a test to show the issue with plurals
Browse files Browse the repository at this point in the history
  • Loading branch information
burzum committed Dec 5, 2017
1 parent df62120 commit f67679b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/TestCase/I18n/Parser/PoFileParserTest.php
Expand Up @@ -188,4 +188,29 @@ public function testParseContextMessages()
$this->assertSame('Titel mit anderem Kontext', __x('another_context', 'title'));
$this->assertSame('Titel ohne Kontext', __('title'));
}

/**
* Test parsing plurals
*
* @return void
*/
public function testPlurals()
{
$parser = new PoFileParser();
$file = APP . 'Locale' . DS . 'de' . DS . 'wa.po';
$messages = $parser->parse($file);

I18n::translator('default', 'de_DE', function () use ($messages) {
$package = new Package('default');
$package->setMessages($messages);

return $package;
});

// Check translated messages
I18n::locale('de_DE');
$this->assertEquals('Standorte', __d('wa', 'Locations'));
I18n::locale('en_EN');
$this->assertEquals('Locations', __d('wa', 'Locations'));
}
}

0 comments on commit f67679b

Please sign in to comment.