Support » Plugin: Loco Translate » Loco translate won’t translate/find strings within esc_html function

  • Resolved cinematic

    (@cinematic)


    Hi, I am just testing the new twentytwenty default theme
    https://github.com/WordPress/twentytwenty

    The continue reading link is included in an esc_html function

    function twentytwenty_read_more_tag() {
    		return sprintf(
    			'<a href="%1$s" class="more-link">%2$s <span class="screen-reader-text">"%3$s"</span></a></p>',
    			esc_url( get_permalink( get_the_ID() ) ),
    			/* Translators: %s: Name of current post */
    			esc_html( 'Continue reading', 'twentytwenty' ),
    			get_the_title( get_the_ID() )
    		);
    	}
    	add_filter( 'the_content_more_link', 'twentytwenty_read_more_tag' );

    If I create a template file for translation the “continue reading” link is not included.
    Thanks for any tips how to translate continue reading with loco translate.

    • This topic was modified 4 weeks, 1 day ago by  cinematic.
    • This topic was modified 4 weeks, 1 day ago by  cinematic.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tim W

    (@timwhitlock)

    esc_html is not a translation function.

    esc_html__ is.

    I don’t know where your code example comes from, but it’s not the latest version of twentytwenty, which uses the function correctly. I suggest you update your install.

    Oh yes, this was the reason. I had an earlier version of the theme. Many improvements now … and everything is translatable now. Great! Thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.