WordPress.org

Ready to get started?Download WordPress

Forums

PDF24 Article To PDF
[resolved] PDF24 and WPML Support (4 posts)

  1. Michael
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/pdf24-post-to-pdf/

  2. pdf24
    Member
    Plugin Author

    Posted 1 year ago #

    Ok,
    then I think we can add this to the next version.

  3. pdf24
    Member
    Plugin Author

    Posted 1 year ago #

    Should now work with the latest version.

  4. pdf24
    Member
    Plugin Author

    Posted 1 year ago #

    Works in the current version.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags