Skip to content
Permalink
Browse files

Adding a test to show the issue with plurals

  • Loading branch information...
burzum committed Dec 5, 2017
1 parent df62120 commit f67679ba87e4098c2268780137ec2d336e5fda6f
Showing with 25 additions and 0 deletions.
  1. +25 −0 tests/TestCase/I18n/Parser/PoFileParserTest.php
@@ -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.
You can’t perform that action at this time.