Posted: February 25, 2014 at 4:34 pm
|
Hi, I am trying to use the Check payment type in EE4 for a system we have in Canada called Interac E-Transfer which allows bank clients to basically email funds to another user. When a user selects this payment method right now, right at the end of the transaction where they are receiving the instructions on how to pay, they receive this message: “After finalizing your registration, you will be transferred to the payment overview where you can view details of how to complete your payment by Check.” Instead, I’d like that to read as: After finalizing your registration, you will be transferred to the payment overview where you can view details of how to complete your payment by Interac e-Transfer.” Please and thank you??? Paul |
|
Hi Paul, I checked the latest EE4 release and that phrase is ready for translation. If the phrase is not currently in the translation files, you could use the gettext filter, as outlined here http://www.viper007bond.com/2011/07/13/changing-core-wordpress-strings/ |
|
Dean, I’m using the gettext filter and it isn’t working. How can I make the change via translation? Paul |
Hi Paul, Can you post the line of code where that’s not translating so we can take a look? |
|
|
Josh, Not sure what you mean by the line of code? Line of code from where? I have a string in the array in the mycustom_filter_gettext function that looks like this: ‘Check.’, “Interac Email Transfer.’, But, “Check.” does not get changed at all. Paul |
|
Hi, That isn’t quite how string translation works, it needs to be the full string, not a partial. This should do the trick function youruniqueprefix_filter_gettext( $translated, $original, $domain ) { // This is an array of original strings // and what they should be replaced with $strings = array( 'After finalizing your registration, you will be transferred to the payment overview where you can view details of how to complete your payment by Check.' => 'After finalizing your registration, you will be transferred to the payment overview where you can view details of how to complete your payment by Cheque.', // Add some more strings here ); // See if the current string is in the $strings array // If so, replace it's 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', 'youruniqueprefix_filter_gettext', 10, 3 ); |
|
That worked! Thanks. |
The support post ‘[EE4} Another phrase that needs wrapped in translate 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.