Support » Plugin: bbPress Notify (No Spam) » Translating the topic email body

  • Resolved promjoe

    (@promjoe)


    Hi,

    We use WPML on our forum to provide users with various language versions of the site. However, it appears that all users receive the new topic notification emails, as well as the new reply emails in English, the default language of the site.

    Looking at the code for the plugin,in the file: “/wp-content/plugins/bbpress-notify-nospam/includes/model/settings.class.php” lines 139 & 145 appear to be setup for translations, and if I look in the WPML string translations I can see the same strings in there, however updating these strings with the translations doesn’t seem to make a difference, and the emails are still sent in English.

    Is there a way to get this to play nicely with translations? It appears that the works already there, it’s just not working when the actual email is sent.

    Joe

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

    (@usestrict)

    Hi @promjoe,

    Those lines are the default for the Topics and Replies templates. They’ll be saved to the database once you save your settings, and no longer translatable via __().

    I’ve added a couple of filters to help you translate the subject and body:

    bbpnns_raw_{$type}_subject
    bbpnns_raw_{$type}_body

    Please update bbpnns to version 2.13.3.

    Thread Starter promjoe

    (@promjoe)

    Thanks for taking the time to implement this for us Vinny. I was just wondering if you could give me some guidance on how these filters would be used? Thanks, Joe

    Plugin Author Vinny

    (@usestrict)

    add_filter( 'bbpnns_raw_topic_subject', 'promjoe_translate_subject', 10, 1);
    function promjoe_translate_subject( $subject ) {
        // Call whatever wpml code does the translating
        
        return $translated_subject;
    }
    
    add_filter( 'bbpnns_raw_topic_body', 'promjoe_translate_body', 10, 1);
    function promjoe_translate_body( $body ) {
        // Call whatever wpml code does the translating
    
        return $translated_body;
    }

    Do the same thing for bbpnns_raw_reply_subject and bbpnns_raw_reply_body.

    Cheers,
    Vinny

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