Support » Plugin: Polylang » How do I translate entries of display options section in YARPP plugin with Polyl

  • Resolved alefam

    (@alefam)


    I would like to translate entries of display options section in YARPP plugin admin area with Polylang plugin. The default texts are “Related posts” and “No related posts”. These strings do not appear in “string translations” section of polylang. I have tried pll_register_string('name', 'string'); and echo pll__('string'); but they did not work. I think I have to put something with $ instead of string. Any help appreciated.

    http://wordpress.org/extend/plugins/polylang/

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

    (@chouby)

    You can add this in custom plugin:

    add_filter('option_yarpp', 'translate_yarpp');
    function translate_yarpp($options) {
    	$to_translate = array('before_related', 'no_results');
    	foreach ($options as $key=>$opt) {
    		if (in_array($key, $to_translate)) {
    			if (is_admin())
    				pll_register_string($key, $opt);
    			else
    				$options[$key] = pll__($opt);
    		}
    	}
    	return $options;
    }

    Hi Choby

    Thank you very much for your great plugin and help. The custom plugin works for “Default display if no results:” section but the “Heading” section doesn’t change and always shows “Related posts:” and obviously cannot be translated. I have replaced array('before_related', 'no_results');with array('thumbnails_heading', 'no_results'); and now it works fine.
    I am really appreciated for your help and time.

    It would be great if you could implement this function into the next version.
    thanks again.

    Plugin Author Chouby

    (@chouby)

    Plugin Author Chouby

    (@chouby)

    You can look at our discussion with mitcho in the link above to have a definitive solution which better integrates with the way YARPP is working.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I translate entries of display options section in YARPP plugin with Polyl’ is closed to new replies.