/** * Returns the current translation for a given locale * * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * @param PropelPDO $con an optional connection object * * @return */ public function getTranslation($locale = '', PropelPDO $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->) { foreach ($this-> as $translation) { if ($translation->get() == $locale) { $this->currentTranslations[$locale] = $translation; return $translation; } } } if ($this->isNew()) { $translation = new (); $translation->set($locale); } else { $translation = ::create() ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) ->findOneOrCreate($con); $this->currentTranslations[$locale] = $translation; } $this->add($translation); } return $this->currentTranslations[$locale]; }