• Resolved janpeeters

    (@janpeeters)


    Hi Frédéric,

    I think about a year ago you helped me with the Pagelines Framework v2 by providing the plugin below to translate certain strings.
    This stopped working since the framework was rewritten as DMS (www.pagelines.com) It has lots of added functionality and I think it’s a great new product.
    But your plugin stopped working and my knowledge of PHP is lacking too much to solve this on my own. So my questions are:
    – should the plugin still be working with Polylang 1.2.4?
    – what in the code could be changed in the current DMS that I need to look into… hooks? filters?

    Thanks, Jan

    <?php
    /*
    Plugin Name: Polylang translates Pagelines strings
    */
    
    add_action('pagelines_hook_pre', 'pll_pagelines_settings');
    
    function pll_pagelines_settings() {
    	if (function_exists('pll_register_string'))
    		add_filter('option_pagelines-settings-two', 'translate_pagelines_settings');
    
    	$pll_options = get_option('polylang');
    	if (!($GLOBALS['wp_rewrite']->using_permalinks() && $pll_options['force_lang']))
    		add_action('wp', 'pll_reload_pl_settings');
    }
    
    // reload pagelines settings to translate them when Polylang defers language loading
    function pll_reload_pl_settings() {
    	$GLOBALS['global_pagelines_settings'] = ( array ) get_option(PAGELINES_SETTINGS);
    }
    
    // translates strings in the array $to_translate
    function translate_pagelines_settings($values) {
    	$to_translate = array(
    		'metabar_standard',
    		'metbar_clip',
    		'continue_reading_text'
    	);
    	foreach ($values as $key=>$value) {
    		if (in_array($key, $to_translate)) {
    			pll_register_string($key, $value);
    			$values[$key] = pll__($value);
    		}
    	}
    	return $values;
    }

    https://www.ads-software.com/plugins/polylang/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    For what I understood, DMS is a separate product from Pagelines. So it’s unlikely that code written for Pagelines works for DMS too.

    All Polylang functions used are still valid.

    Thread Starter janpeeters

    (@janpeeters)

    Hi Frederic,

    Thanks for letting me know that on your side all has stayed the same. Heading back to Pagelines for some further research.

    Thanks, Jan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom string translation stopped working in Pagelines DMS’ is closed to new replies.