<?php
add_filter( 'wpcf7_validate_select*', 'custom_select_validation_filter', 20, 2 );
function custom_select_validation_filter( $result, $tag ) {
    if(!function_exists("pll_translate_string")){
        return $result;
    }
    $langs = pll_languages_list();
    $translated = [];
    
    
    $f_name = $tag["name"];
    $f_label = str_replace( ['{', '}*', '} *', '}', '*'],"", $tag->values[0] );
    
    
    foreach($langs as $lang){
        $translated_x = pll_translate_string($f_label, $lang);
        if($translated_x) {
            $translated[] = $translated_x;
        }
    }
    
    $custom_select_value = ( isset($_POST[$f_name]) ) ? htmlspecialchars( $_POST[$f_name] ) : "";
    $custom_select_value = str_replace(['{', '}*', '} *', '}', '*'],"", $custom_select_value );
    
	if ( 
	    empty( $custom_select_value ) || 
	    in_array($custom_select_value, $translated )
    ){
		$result->invalidate($tag, __( 'This field is required.', 'CF7' ) );
	}
	
	

	return $result;
}