On 23-11-2009 at 05:28:13 <lo...@nic.fi> wrote:

I want my translator to translate if there's a translation available and use the key text when there isn't. So I added a few lines to translate function. Does this seem like a good way of doing this?

public function translate($key, $htmlencode=true) {
        $value = @$this->_currentDomain[$key];
        if (empty($value)) {
                return $key;

It's better to use:

if (!isset($this->_currentDomain[$key])) {
  return $key;

$value = $this->_currentDomain[$key];

This won't trigger PHP errors.

regards, Kornel

PHPTAL mailing list

Reply via email to