/** * This function translates the object's property's value. * * @access public * @param string $parameters['locale'] * the locale * @param string $parameters['property'] * the property * @return string the translation * @uses DEFAULT_LOCALE for the case the locale is not set explicitly */ public function translate($parameters) { if (isset($parameters['property'])) { if (isset($parameters['locale']) && isset($this->translations[$parameters['property']][$locale])) { $translation = $this->translations[$parameters['property']][$parameters['locale']]; } else { if (isset($_SESSION['locale']) && isset($this->translations[$parameters['property']][$_SESSION['locale']])) { $translation = $this->translations[$parameters['property']][$_SESSION['locale']]; } else { if (isset($this->translations[$parameters['property']][DEFAULT_LOCALE])) { $translation = $this->translations[$parameters['property']][DEFAULT_LOCALE]; } else { $translation = ':-)'; } } } if (isset($parameters['isSlug']) && $parameters['isSlug'] && isset($this->translations['label']) && ':-)' === $translation) { if (isset($parameters['locale']) && isset($this->translations['label'][$locale])) { $label = $this->translations['label'][$parameters['locale']]; } else { if (isset($_SESSION['locale']) && isset($this->translations['label'][$_SESSION['locale']])) { $label = $this->translations['label'][$_SESSION['locale']]; } else { if (isset($this->translations['label'][DEFAULT_LOCALE])) { $label = $this->translations['label'][DEFAULT_LOCALE]; } else { $label = ':-)'; } } } return \psdtohtml\Model::slugify(array('original' => $label)); } else { return $translation; } } else { exit('Millist omadust tõlgime?'); } }