WPML and Disallow special characters how to translate ERROR message

Hello, I need solution how to translate error message (Error: Please use only Latin letters, numbers, space or -') in this part which added in FUNCTIONS PHP file as code. On WPML forum they say that i need contact here

add_filter( 'gform_field_validation', function( $result, $value, $form, $field ) { $pattern = "/^[a-zA-Z0-9 -,.]*$/"; // note the space before the closing brace if ( strpos( $field->cssClass, 'letters_spaces' ) !== false && ! preg_match( $pattern, $value ) ) { $result['is_valid'] = false; $result['message'] = 'Error: Please use only Latin letters, numbers, space or -'; } return $result; }, 10, 4 );

Hi Tom. You could use a conditional based on the language on that page. There should be a WPML function you can use to get the language in your code, then do something like this:

if ( $language == 'en_EN' ) {
    $result['message'] = 'Error: Please use only Latin letters, numbers, space or -';
}
else if ( $language == 'fr_FR' ) {
    $result['message'] = 'Erreur : Veuillez n'utiliser que des lettres latines, des chiffres, des espaces ou -';
}

You would need to find out if there is a WPML constant already available to use, or use a WPML function to get the $language.