コード例 #1
0
ファイル: LocaleTest.php プロジェクト: jivoo/core
 public function testExtend()
 {
     $l1 = new Locale();
     $l1->set('Hello, World!', 'Hej, Verden!');
     $l1->set('Hello, %1!', 'Hej, %1!');
     $l1->set('There are %1 users', array('Der er %1 bruger', 'Der er %1 brugere'));
     $l2 = new Locale();
     $l2->set('Create user', 'Opret bruger');
     $l2->set('Hello, %1!', 'Halløj, %1!');
     $l2->extend($l1);
     $this->assertEquals('Hej, Verden!', $l2->get('Hello, World!'));
     $this->assertEquals('Hej, World!', $l2->get('Hello, %1!', 'World'));
     $this->assertEquals('Der er 0 brugere', $l2->nget('There are %1 users', 'There is %1 user', 0));
     $this->assertEquals('Der er 1 bruger', $l2->nget('There are %1 users', 'There is %1 user', 1));
     $this->assertEquals('Der er 2 brugere', $l2->nget('There are %1 users', 'There is %1 user', 2));
 }