/** * Get JSON containing all translation for a given jelix property file. * @param string $property Name of the property file. Ex: map if searched file is map.UTF-8.properties * @param string $lang Language. Ex: fr_FR (optional) * @return binary object The image for this project. */ function getDictionary() { $rep = $this->getResponse('json'); // Get the property file $property = $this->param('property'); $lang = $this->param('lang'); if (!$lang) { $lang = jLocale::getCurrentLang() . '_' . jLocale::getCurrentCountry(); } $data = array(); $path = jApp::appPath() . 'modules/view/locales/' . $lang . '/' . $property . '.UTF-8.properties'; if (file_exists($path)) { $lines = file($path); foreach ($lines as $lineNumber => $lineContent) { if (!empty($lineContent) and $lineContent != '\\n') { $exp = explode('=', trim($lineContent)); if (!empty($exp[0])) { $data[$exp[0]] = jLocale::get('view~dictionnary.' . $exp[0], null, $lang); } } } } $rep->data = $data; return $rep; }