• Resolved Michael

    (@michael2012-1)


    Hey all,

    I am using PDF24 as sidebar widget and the WPML plugin. If I am not wrong PDF24 doesn’t support WPML.

    To change this (for the widget):
    1. find the common.php file in your [PDF24 plugin folder]/inc
    ( ./wp-content/plugins/pdf24-post-to-pdf/inc/common.php – by default )
    2. Backup this file ??
    3. now go to the subfolder “inc” and edit the common.php file
    4. find the function “pdf24Plugin_replaceLang” and replace the whole function with the following code:

    function pdf24Plugin_replaceLang($str, $count, $searchReplace = null) {
    	if($searchReplace != null && !is_array($searchReplace)) {
    		$searchReplace = null;
    	}
    
    	$langs = pdf24Plugin_getLangElements();
    	$search = array();
    	$replace = array();
    	foreach($langs as $key => $val) {
    		$k = '{lang_'. $key .'}';
    		if($searchReplace && isset($searchReplace[$k])) {
    			$val = $searchReplace[$k];
    		}
    		$search[] = $k;
    		$replace[] = $val;
    	}
    
    	if($searchReplace && isset($searchReplace['{lang_sendAsPDF}'])) {
    		$search[] = '{lang_sendAsPDF}';
    		$replace[] = $searchReplace['{lang_sendAsPDF}'];
    	} else {
    		$search[] = '{lang_sendAsPDF}';
    		$replace[] = $count == 1 ? pdf24Plugin_getLangVal('sendArticleAsPDF') : pdf24Plugin_getLangVal('sendArticlesAsPDF');
    	}
    
    	if($searchReplace && isset($searchReplace['{lang_downloadAsPDF}'])) {
    		$search[] = '{lang_downloadAsPDF}';
    		//$replace[] = $searchReplace['{lang_downloadAsPDF}'];
    		$replace[] = __( 'Artikel als PDF Download', 'pdf24' ); //MOD
    	} else {
    		$search[] = '{lang_downloadAsPDF}';
    		//$replace[] = $count == 1 ? pdf24Plugin_getLangVal('downloadArticleAsPDF') : pdf24Plugin_getLangVal('downloadArticlesAsPDF');
    		$replace[] = __( 'Artikel als PDF Download', 'pdf24' ); //MOD
    	}
    
    	return str_replace($search, $replace, $str);
    }

    Works great for me.

    https://www.ads-software.com/extend/plugins/pdf24-post-to-pdf/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PDF24 and WPML Support’ is closed to new replies.