use strtr instead of printf to expand variables in translated strings

this means that the error arguments are now passed as an associative
array.

exemple:

$err->raise("foo", "error message: %error", array('%error' => "blah"));
This commit is contained in:
Antoine Beaupré 2008-04-24 18:07:11 +00:00
parent 15f9312e72
commit fc9c612c21
1 changed files with 2 additions and 2 deletions

View File

@ -90,9 +90,9 @@ class m_err {
*/ */
function errstr() { function errstr() {
if (is_string($this->error)) { if (is_string($this->error)) {
$msg = sprintf(_("err_".$this->clsid."_generic: ")._($this->error)."\n",$this->param); $msg = strtr(_("err_".$this->clsid."_generic: ")._($this->error)."\n",$this->param);
} else { } else {
$msg = sprintf(_("err_".$this->clsid."_".$this->error)."\n",$this->param); $msg = strtr(_("err_".$this->clsid."_".$this->error)."\n",$this->param);
} }
return $msg; return $msg;
} }