.(dot) 기반의 item의 line으로 변형할 수 있게 도와주는 포매터 기능 제공
Author: XE Developers (developers@xpressengine.com)
Exemplo n.º 1
0
 /**
  * @param string $source 데이터 소스
  * @return LangData
  */
 public function load($source)
 {
     $data = $this->files->getRequire($source);
     $langData = new LangData();
     $langData->setData($data);
     return $langData;
 }
Exemplo n.º 2
0
 public function testLangData()
 {
     $data = ['previous' => ['ko' => '이전', 'en' => 'Prev'], 'next' => ['ko' => '다음', 'en' => 'Next'], 'week' => ['mon' => ['ko' => '월', 'en' => 'monday'], 'tue' => ['ko' => '화', 'en' => 'tueseday']]];
     $expectedData = ['previous' => ['ko' => '이전', 'en' => 'Prev'], 'next' => ['ko' => '다음', 'en' => 'Next'], 'week.mon' => ['ko' => '월', 'en' => 'monday'], 'week.tue' => ['ko' => '화', 'en' => 'tueseday']];
     $retrievedData = [];
     $langData = new LangData();
     $langData->setData($data);
     $langData->each(function ($item, $locale, $value) use(&$retrievedData) {
         $retrievedData[$item][$locale] = $value;
     });
     $this->assertSame($expectedData, $retrievedData);
 }
 public function testPutLangData()
 {
     $cache = $this->getCache();
     $cache->shouldReceive('get')->andReturn(null);
     $cache->shouldReceive('set');
     $cache->shouldReceive('flush');
     $conn = $this->getConn();
     $conn->shouldReceive('first')->andReturn(['value' => 'message']);
     $conn->shouldReceive('count')->andReturnValues([0, 1]);
     $langData = new LangData();
     $langData->setData(['foo', 'foo', 'foo']);
     $cachedDb = new TransCachedDatabase($cache, $conn);
     $cachedDb->putLangData('ns', $langData);
     $cachedDb->putLangData('ns', $langData);
     $this->assertSame('message', $cachedDb->getLine('ns', 'locale', 'item'));
 }
 public function putLangData($namespace, LangData $langData)
 {
     $langData->each(function ($item, $locale, $value) use($namespace) {
         $this->putLine($namespace, $item, $locale, $value);
     });
 }