qTranslate is a lets say sufficient free plugin that enables multilingual wordpress setups. For a free plugin it is really feature rich, but when it comes to interact with the really nice shopp plugin, there are a few shortcommings. Especially, there is no way (besides writing qtranslate’s comments by hand) to translate the product summaries. This however can be resolved rather easy, because the product-summary field is more or less identical to wordpress own postexcerpt field. The later can be translated by qTranslate with qTranslates internal qtrans_modifyExcerpt() function.
So if we want to add translation für shopp product summaries, we simply have to take that function, adjust it to our needs and call it at the right spot. Without further ado – add the code below to your functions.php and you are done.
function tao_qtrans_modifyProductSummary() {
global $q_config;
echo "<script type="text/javascript">\n";
echo "if(jQuery('#summary').size()>0) {";
echo $q_config['js']['qtrans_is_array'];
echo $q_config['js']['qtrans_xsplit'];
echo $q_config['js']['qtrans_split'];
echo $q_config['js']['qtrans_integrate'];
echo $q_config['js']['qtrans_switch_postbox'];
echo $q_config['js']['qtrans_use'];
$el = qtrans_getSortedLanguages();
foreach($el as $language) {
echo qtrans_createTitlebarButton('product-summary', $language, 'summary', 'qtrans_switcher_product-summary_'.$language);
echo qtrans_createTextArea('product-summary', $language, 'summary', 'qtrans_switcher_product-summary_'.$language);
}
echo "qtrans_switch_postbox('product-summary','summary','".$q_config['default_language']."');";
echo "jQuery('#summary').hide();";
echo "}";
echo "\n</script>\n";
}
if( function_exists('qtrans_createTitlebarButton') &&
function_exists('qtrans_createTextArea') ) {
add_filter('admin_footer', 'tao_qtrans_modifyProductSummary');
}



Comments