Translating the comment section

So, I’ve finally decided to get rid of Disqus and use Discourse also to display comments on my blog.

I’ve been searching this part of the forum, but I can’t really find out how to translate the text that’s displayed under my blog posts. For example “Notable replies” and “Continue the discussion at…”

Is there anyone who can explain to me in a pedagogic way? :slight_smile:

Thanks in advance.

1 Like

I’m working right now to make it all the user facing text configurable from the admin section. I think that can be ready soon - later this week - if it gets approval. There’s also an issue on the plugin’s github page about it: https://github.com/discourse/wp-discourse/issues/251

For now you can do something like this:

add_filter( 'gettext', 'change_notable_replies_text', 20, 3 );
function change_notable_replies_text( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    // The text content you want to change.
    case 'Notable Replies' : 
            // What you want to change that text to.
            $translated_text = __( 'Our Favourite Replies', 'wp-discourse' );
        break;
    }

    return $translated_text;
}

I can add more detail if this isn’t clear. See this for more detail about the gettext hook:

4 Likes