Maybe this:
global $polylang;
if (isset($polylang) && class_exists('Polylang_Core') && $polylang instanceof Polylang_Core && isset($polylang->curlang)) {
$join .= " INNER JOIN $wpdb->term_relationships AS pll_tr ON pll_tr.object_id = p.ID";
$where .= $wpdb->prepare(" AND pll_tr.term_taxonomy_id = %d", $polylang->curlang->term_taxonomy_id);
}