Example #1
0
 /**
  * Method to test parse().
  *
  * @return void
  *
  * @covers Windwalker\Language\Format\JsonFormat::parse
  */
 public function testParse()
 {
     $file = file_get_contents(__DIR__ . '/../fixtures/json/en-GB.json');
     $lang = new Language();
     $lang->addStrings($this->instance->parse($file));
     $this->assertEquals($lang->translate('WINDWALKER_LANGUAGE_TEST_SAKURA'), 'Sakura');
     $this->assertEquals($lang->translate('WINDWALKER_LANGUAGE_TEST_Olive'), 'Olive');
 }
Example #2
0
 /**
  * Method to test normalize().
  *
  * @return void
  *
  * @covers Windwalker\Language\Language::normalize
  */
 public function testNormalize()
 {
     $this->assertEquals('windwalker.is.good', $this->instance->normalize('Windwalker is good ~~~!!!'));
     $this->instance->setNormalizeHandler(function ($value) {
         return 'WINDWALKER-ROCKS';
     });
     $this->assertEquals('WINDWALKER-ROCKS', $this->instance->normalize('Windwalker is good ~~~!!!'));
 }
Example #3
0
 /**
  * translate
  *
  * @param   string  $text
  *
  * @return  string
  */
 public function translate($text)
 {
     return $this->instance->translate($text);
 }