public function execute($params) { $lang = $params[0]; if (!in_array($lang, Config::getAllLangs())) { throw new Exception('Specified lang is not part of this project handled languages'); } foreach (FileUtils::getAllFiles(APP_ROOT . 'app/' . APP_NAME) as $file) { $result = preg_match_all('`(?:__|_e)\\(\'(.+)\'(?:,array\\(.+\\))?\\)`sU', file_get_contents($file), $matches); foreach ($matches[1] as $elem) { $nbfound++; __(str_replace("\\'", "'", $elem)); } } $arr = T::getInstance($lang)->getStrings(); T::getInstance($lang)->save(true); }
function __($string, $args = null) { $tr = T::getInstance(); return $tr->translate($string, $args); }