static function translate($key, $params = array(), $locale = null)
{
if (!isset($locale)) {
$locale = AppLocale::getLocale();
}
if (($key = trim($key)) == '') {
return '';
}
$localeFiles =& AppLocale::getLocaleFiles($locale);
$value = '';
for ($i = count($localeFiles) - 1; $i >= 0; $i--) {
$value = $localeFiles[$i]->translate($key, $params);
if ($value !== null) {
return $value;
}
}
// Add a missing key to the debug notes.
$notes =& Registry::get('system.debug.notes');
$notes[] = array('debug.notes.missingLocaleKey', array('key' => $key));
if (!HookRegistry::call('PKPLocale::translate', array(&$key, &$params, &$locale, &$localeFiles, &$value))) {
// Add some octothorpes to missing keys to make them more obvious
return '##' . htmlentities($key) . '##';
} else {
return $value;
}
}