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\Gettext($translationSources, 'de_DE'); $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']); }
/** * 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\Gettext($i18nPaths, $lang); $content = array('admin' => $i18n->getAll('admin'), 'admin/ext' => $i18n->getAll('admin/ext')); return json_encode($content, JSON_FORCE_OBJECT); }