Support

Home Forums Event Espresso Premium EE 4 Change wording generated by the [INVOICE_LINK] short code

EE 4 Change wording generated by the [INVOICE_LINK] short code

Posted: February 12, 2014 at 11:19 am

Viewing 2 reply threads


Chris Stambaugh

February 12, 2014 at 11:19 am

Hi,

I know there is an on changing things with EE 3.

Where is the event_espresso-en_US.po file for Event Espresso 4 that I can edit with Poedit? (Assuming that’s still how we do this with EE4).

Thanks,

Paul


Josh

  • Support Staff

February 12, 2014 at 12:13 pm

Hi Paul,

The language files from Event Espresso 3 can be used to translate Event Espresso 4, but I don’t recommend going the Poedit route because I think Poedit is overkill and clunky to use to change a few text strings, so I can offer the suggestion to use a custom function instead.

Here’s something you can add to your theme’s functions.php file or in a custom snippet plugin. Your custom text can be entered between the %s on second part of the the fifth line:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        '%sClick here for Invoice%s' => '%sChanged Invoice link text%s',
        // Add some more strings here
    );
 
    // See if the current string is in the $strings array
    // If so, replace its translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = &get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );


Chris Stambaugh

February 12, 2014 at 1:14 pm

Josh,

That worked great! Thanks.

Paul

Viewing 2 reply threads

The support post ‘EE 4 Change wording generated by the [INVOICE_LINK] short code’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso