WPML posts_joins on translated items

Finally able to find out a working solution.
The inner join has to join term_taxonomy (where we find the term) to icl_translations with current language. And then from icl_translation to the origin language to get the element_id that then this element_id to term_relationships (where all the product from the origin product_cat are listed).

If that helps anyone, here it is :

function cf_search_join( $join ) {
    global $wpdb;

    $wpml_default_lang  = apply_filters('wpml_default_language', NULL );
    $wpml_current_lang  = apply_filters('wpml_current_language', NULL );
    $is_default_lang    = ($wpml_default_lang === $wpml_current_lang ? true : false);
    $wpml_table         = $wpdb->prefix . 'icl';


    if ( is_search() ) {

      $join .= "INNER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id ";

        if($is_default_lang) {
          $join .= "INNER JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id ";
        } else {
          $join .= "
          INNER JOIN {$wpml_table}_translations trans_default ON (
            trans_default.element_id = {$wpdb->term_relationships}.term_taxonomy_id
            AND
            trans_default.language_code="".$wpml_default_lang.""
          )

          INNER JOIN {$wpml_table}_translations trans_current ON (
            trans_default.trid = trans_current.trid
            AND
            trans_current.language_code="".$wpml_current_lang.""
          )

          INNER JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_taxonomy_id = trans_current.element_id
          ";
        }

        $join .= "INNER JOIN {$wpdb->terms} ON {$wpdb->terms}.term_id = {$wpdb->term_taxonomy}.term_id ";
    }

    return $join;
}
add_filter('posts_join', 'cf_search_join' );

/**
 * Modify the search query with posts_where
 *
 * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where
 */
function cf_search_where( $where ) {
    global $pagenow, $wpdb;

    $wpml_default_lang  = apply_filters('wpml_default_language', NULL );
    $wpml_current_lang  = apply_filters('wpml_current_language', NULL );
    $is_default_lang    = ($wpml_default_lang === $wpml_current_lang ? true : false);
    $wpml_table         = $wpdb->prefix . 'icl';

    if ( is_search()) {


       $where = preg_replace(
       "/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
       "
         (".$wpdb->posts.".post_title LIKE $1)
         OR
         (".$wpdb->posts.".post_content LIKE $1)
         OR
         (".$wpdb->terms.".name LIKE $1)
         OR
         (".$wpdb->term_taxonomy.".description LIKE $1)
       ", $where );


    }

    return $where;
}
add_filter( 'posts_where', 'cf_search_where' );

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino