Welcome Guest, Not a member yet? Register   Sign In
Form Validation Type Match Not Translating
#1

[eluser]Unknown[/eluser]
I am working on a multilingual site using several language files and I noticed that on the form validation it didn't translate the referencing form field in the 'match[]' validation type.

For example it would output something like this:

"The Confirm Password field does not match the lang:label_password field."
instead of
"The Confirm Password field does not match the Password field."

I fixed it by changing the following in the Form_validation library:
Code:
// Is the parameter we are inserting into the error message the name
// of another field?  If so we need to grab its "field label"

if (isset($this->_field_data[$param]) AND isset($this->_field_data[$param]['label']))
{
  $param = $this->_field_data[$param]['label'];
}
                
// Build the error message
/* Old Code */
//$message = sprintf($line, $this->_translate_fieldname($row['label']), $param);

/* New Code */
$message = sprintf($line, $this->_translate_fieldname($row['label']), $this->_translate_fieldname($param));




Theme © iAndrew 2016 - Forum software by © MyBB