Exemple #1
0
 /**
  * Tests the query Gettext::query
  *
  * @param  UnitTester $I
  * @author Serghei Iakovlev <*****@*****.**>
  * @since  2016-01-16
  */
 public function query(UnitTester $I)
 {
     $I->wantTo("translate by using Gettext::query");
     $translator = new Gettext(['locale' => 'en_US.utf8', 'defaultDomain' => 'messages', 'directory' => PATH_DATA . 'translation/gettext', 'category' => LC_MESSAGES]);
     $I->assertEquals($translator->query('你好!'), 'Hello!');
     $I->assertEquals($translator->query('你好 %name%!', ['name' => 'Phalcon']), 'Hello Phalcon!');
 }
Exemple #2
0
 public function testGettextQueryUkranian()
 {
     $translator = new Gettext(['locale' => 'uk_UA.utf8', 'defaultDomain' => 'messages', 'directory' => __DIR__ . DIRECTORY_SEPARATOR . 'locale']);
     $this->assertEquals('Привіт', $translator->query('Hello'));
     $this->assertEquals('Привіт', $translator->_('Hello'));
 }