/**
  * Returns the JSON encoded translations for the ExtJS client.
  *
  * @param string $lang ISO language code like "en" or "en_GB"
  * @return string JSON encoded translation object
  */
 protected function getJsonClientI18n($lang)
 {
     $i18nPaths = Base::getAimeos()->getI18nPaths();
     $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true));
     $content = array('client/extjs' => $i18n->getAll('client/extjs'), 'client/extjs/ext' => $i18n->getAll('client/extjs/ext'));
     return json_encode($content, JSON_FORCE_OBJECT);
 }
 /**
  * Returns the JSON encoded translations for the ExtJS client.
  *
  * @param array $i18nPaths List of file system paths which contain the translation files
  * @param string $lang ISO language code like "en" or "en_GB"
  * @return string JSON encoded translation object
  */
 protected function getJsonClientI18n(array $i18nPaths, $lang)
 {
     $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true));
     $content = array('admin' => $i18n->getAll('admin'), 'admin/ext' => $i18n->getAll('admin/ext'));
     return json_encode($content, JSON_FORCE_OBJECT);
 }
Example #3
0
 public function testGetAll()
 {
     $ds = DIRECTORY_SEPARATOR;
     $translationSources = array('testDomain' => array(__DIR__ . $ds . 'testfiles' . $ds . 'case1', __DIR__ . $ds . 'testfiles' . $ds . 'case2'));
     $object = new \Aimeos\MW\Translation\Zend2($translationSources, 'gettext', 'ka_GE');
     $result = $object->getAll('testDomain');
     $this->assertArrayHasKey('Car', $result);
     $this->assertEquals('KFZ', $result['Car'][0]);
     $this->assertEquals('KFZs', $result['Car'][1]);
     $this->assertArrayHasKey('File', $result);
     $this->assertEquals('Datei mehr', $result['File'][0]);
     $this->assertEquals('Dateien mehr', $result['File'][1]);
     $this->assertArrayHasKey('Update', $result);
     $this->assertEquals('Neue Version', $result['Update']);
 }