This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: transposh

#30299
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Well, unfortunately transposh is not supported officially, but I recall we were able to suggest a custom code in a previous ticket, that worked with some results.

Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_action('asl_layout_in_form', 'aslp_in_form_add_param', 10);
add_action('asp_layout_in_form', 'aslp_in_form_add_param', 10);
function aslp_in_form_add_param() {
	echo '<input type=hidden name="trp_lang" value="'.transposh_get_current_language().'">';
}

add_filter('asl_results', 'aslp_add_lang_param', 10, 1);
add_filter('asp_results', 'aslp_add_lang_param', 10, 1);
function aslp_add_lang_param($results) {
	if (is_array($_POST['options']))
		$options = $_POST['options'];
	else
		parse_str($_POST['options'], $options);
	$url = get_site_url();
	$lang_url = $url . '/' . $options['trp_lang'];
	foreach ($results as $k=>&$r) {
			$r->link = str_replace($url, $lang_url, $r->link);
	}
	return $results;
}