Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    I have never used Polylang, but looking at their documentation and some experimenting, I think this is something you can do with a function, if you are able to add some code to your site (for example, to your functions.php file). If you do so, please practice safe coding, back up your files, etc. etc. Here is what I came up with, which seems to work in the admin, although I don’t know how to check an alternate language RSS feed (source):

    
    add_action( 'admin_init', 'prefix_sendimagesrss_polylang' );
    /**
     * Add a string from Send Images to RSS settings to Polylang strings.
     */
    function prefix_sendimagesrss_polylang() {
    	if ( ! function_exists( 'pll_register_string' ) ) {
    		return;
    	}
    	$setting = get_option( 'sendimagesrss' );
    	pll_register_string( 'Read More Text', $setting['read_more'], 'Send Images to RSS', false );
    }
    

    Hope that helps you get started. Good luck!

    • This reply was modified 7 years, 12 months ago by Robin Cornett. Reason: added source link
    Thread Starter livingamongnature

    (@livingamongnature)

    Nope, it doesn’t seem to work.
    Well it pops up in the database from polylang, but in my RSS feed there is no translation.
    By the way, I don’t need to have the ‘Read more text’ translated. The actual string is what I need.
    Which is standard: Continue reading %%POSTNAME%% at %%BLOGNAME%%.

    In the German version I would like: Mehr zu %%POSTNAME%% bei %%BLOGNAME%%.

    I make a difference in the webfeed by.
    https://www.livingamongnature.com/en/feed
    or
    https://www.livingamongnature.com/de/feed

    I hope you can help me further with this data.

    Plugin Author Robin Cornett

    (@littlerchicken)

    So, I guess what I would try then is to just skip Polylang and modify the read more text directly using a filter. Here’s (untested) code that should work for you, but I do not know how Polylang sets up the language feeds, so the original conditional is just a guess on my part. Everything after that, though, should apply.

    
    add_filter( 'send_images_rss_excerpt_read_more', 'prefix_german_read_more', 10, 5 );
    /**
     * Change the Send Images to RSS read more text for excerpts in the German feed.
     * @param $output
     * @param $read_more
     * @param $blog_name
     * @param $post_name
     * @param $permalink
     *
     * @return string
     */
    function prefix_german_read_more( $output, $read_more, $blog_name, $post_name, $permalink ) {
    	/**
    	 * no idea what your conditional would need to be here,
    	 * but there should be a way to target the German feed separately
    	 * from the English (or other) feed.
    	 *
    	 */
    	if ( ! is_feed( 'de' ) ) {
    		return $output;
    	}
    	$output = sprintf( '<a href="%s">Mehr zu %s bei %s</a>', esc_url( $permalink ), esc_html( $post_name ), esc_html( $blog_name ) );
    	return $output;
    }

    Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Translating String’ is closed to new replies.