/** * sets the locale (language) to use for the validation error messages of all elements * in the form. * * @access public * @param string language code * @param string optional language file * @return bool True on success */ function setLocale($locale, $languageFile = null) { if (!is_null($languageFile)) { $languageData = patForms::parseLocaleFile($languageFile); $customLocales = patForms::getStaticProperty('customLocales'); $customLocales[$locale] = $languageData; patForms::setStaticProperty('customLocales', $customLocales); } if (isset($this) && is_a($this, 'patForms')) { $this->locale = $locale; if (!empty($this->elements)) { $cnt = count($this->elements); for ($i = 0; $i < $cnt; $i++) { $this->elements[$i]->setLocale($locale); } } } else { patForms::setStaticProperty('locale', $locale); } return true; }