Support

Home Forums Event Espresso Premium Checkout page: need to change strings

Checkout page: need to change strings

Posted: June 1, 2020 at 3:59 pm

Viewing 6 reply threads


ICLE

June 1, 2020 at 3:59 pm

Need to change ‘Expiry Month’ => ‘Expiriation Month’ but the nmethod featured in https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function seems to work for strings inside the normal display of EE but not necessarily in the checkout page. Any suggestions?


Tony

  • Support Staff

June 1, 2020 at 5:34 pm

Hi ICLE,

Based on ‘Expiry Month’ I’m assuming this is on the payment options?

If so, which payment method is this on?

If it’s not on the payment options can you add a screenshot so I can see where this show please?


ICLE

June 2, 2020 at 8:01 am

i.imgur.com/RcCO0vZ.png
FirstData PayEezy


ICLE

June 2, 2020 at 8:20 am

Oops. That URL is bad. Use this one:
https://i.imgur.com/RcGO0vZ.png


Tony

  • Support Staff

June 2, 2020 at 8:35 am

Yeah ok so thats within the payment method itself, but the above function works fine for changing that string.

https://monosnap.com/file/RAvxCbSSuWsnIJLqia0qrhOTJXV4vm

That is just from adding 'Expiry Month' => 'Expiry Month TONY', to the $strings array on that function.

Are you adding it to your theme’s functions.php or a custom functions plugin as it likely needs to go in the latter:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


ICLE

June 2, 2020 at 9:49 am

Ok, I’ve made a plugin and it behaves like a plugin.
it doesn’t seem to do what you did above. Here is the code:

/* Function to swap out text strings site wide */
function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'Sold Out' => 'Full',
		'Expiry' => 'Expiration',
        // 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 );

/*end function to swap out text strings site wide */

Do I need to do something with the domain declaration?


Tony

  • Support Staff

June 2, 2020 at 1:57 pm

You need to use the whole string when translating.

So you can’t translate just ‘Expiry’ within ‘Expiry Month’, you need to translate the full string, it’s just how translations work.

Viewing 6 reply threads

The support post ‘Checkout page: need to change strings’ 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