This topic has 5 replies, 2 voices, and was last updated 10 years by Abe.

  • Author
  • #9681
     mpitka
    Participant

    Hi!

    How can I translate pmpro email-subjects?

    I appreciate your help!

    #9749
     Abe
    Keymaster

    This is an example from their site that goes to your functions.php

    COPY CODE
    
    /*
    Change email subjects.
     
    The function checks $email->template and updates the subject as needed.
     
    The email template name will be equivalent to the filenames in the /email/ folder of the PMPro plugin.
    */
    function my_pmpro_email_subject($subject, $email)
    {
    //only checkout emails
    if($email->template == "checkout_free")
    {
    $subject = "Thank you, " . $email->data["name"] . ", for using " . get_bloginfo("name");
    }
    return $subject;
    }
    add_filter("pmpro_email_subject", "my_pmpro_email_subject", 10, 2);
    

    to translate the you need to wrap the strings inside a wordpress translation function. example with the “Thank you, ” above:

    $subject = __(“Thank you, “, “kleo_framework”) . $email->data[“name”] . “, for using ” . get_bloginfo(“name”);

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #9881
     mpitka
    Participant

    hmm…. i don’t really understand what you mean? Can you give a full example?

    Thanks!

    #9973
     Abe
    Keymaster

    Well the example is there but you need to add the translation function like this

    COPY CODE
    
    function my_pmpro_email_subject($subject, $email)
    {
    //only checkout emails
    if($email->template == "checkout_free")
    {
    $subject = __("Thank you","kleo_framework"), " . $email->data["name"] . __(", for using ", "kleo_framework") . get_bloginfo("name");
    }
    return $subject;
    }
    add_filter("pmpro_email_subject", "my_pmpro_email_subject", 10, 2);
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #10135
     mpitka
    Participant

    Is there any way to translate every message at once, like: “information about your payment” etc.

    #10282
     Abe
    Keymaster

    Hi, I don’t think so that can be done

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?