Make etemplate able to handle multiple calls to egw::lang() in the same line

This commit is contained in:
Nathan Gray 2009-09-11 20:13:06 +00:00
parent 52a96767cf
commit c8f411bd4c

View File

@ -1875,9 +1875,11 @@ class etemplate extends boetemplate
$on = str_replace($matches[0],$matches[1],$on);
}
// we need to search ungready (shortest possible match), to avoid catching to much
if (preg_match('/egw::lang\(["\']{1}(.*)["\']{1}\)/U',$on,$matches)) {
$str = lang($matches[1]);
$on = str_replace($matches[0],'\''.addslashes($str).'\'',$on);
if (preg_match_all('/egw::lang\(["\']{1}(.*)["\']{1}\)/U',$on,$matches)) {
foreach($matches[1] as $n => $string) {
$str = lang($string);
$on = str_replace($matches[0][$n],'\''.addslashes($str).'\'',$on);
}
}
// inserts the styles of a named template