Support

Home Forums Event Espresso Premium Translation of a sentence in checkout page

Translation of a sentence in checkout page

Posted: February 25, 2020 at 3:40 am

Viewing 6 reply threads


children-first

February 25, 2020 at 3:40 am

Hello everybody,

I just have to adjust one sentence in the checkout page.
Unfortunately I couldn’t find anything in the checkout PHP files and in the forum.

Unfortunately I don’t know what the sentence is in English.
In German it reads:
“Anmerkung: Änderungen in Ihren persönlichen Informationen werden mit Ihrem Benutzerprofil synchronisiert.”
Screenshot: Screenshot

This sentence should be changed to the following:
“Anmerkung: Änderungen in Deinen persönlichen Informationen werden mit Deinem Benutzerprofil synchronisiert.”

For the previous translations into the German language I added a function in the function.php.
The function works as follows:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
		'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.' => 'Um Deine Anmeldung zu bearbeiten, bitten wir Dich, folgende Angaben zu machen.%1$sBitte beachte, dass alle mit einem Stern (%2$s) gekennzeichneten Felder Pflichtfelder sind.',
        '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.' => '%1$sVielen Dank%2$sDeine Ticketbuchung wurde erfolgreich durchgeführt%3$sWir haben dir eine E-Mail geschickt, in der alle Details stehen.',
		'This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.' => 'Mit dieser Option kannst Du die oben angegeben Informationen für alle weiteren Teilnehmerinformationen verwenden. %sAnmerkung:%s Einige Veranstaltungen können zusätzliche Informationen benötigen, die Du eingeben musst, um die Registrierung abzuschließen.',
		'Registration Details' => 'Ticketdetails',
		"We're sorry, but all tickets sales have ended because the event is expired." => 'Alle Tickets sind ausgebucht.',
		'Access' => 'Zugang',
		'Total%sSold' => 'Bereits gebucht',
		'Total Spaces%sLeft' => 'Verfügbare Tickets',
		'REG Code' => 'Buchungscode',
		'REG Status' => 'Buchungsstatus',
        // 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 );

Could you tell me what the sentence is in English so that I can translate it correctly into German?

Many thanks in advance!

Best regards,
Simon


Tony

  • Support Staff

February 25, 2020 at 4:55 am

Hi there,

One way to find these strings is to search our translations here:

https://translate.eventespresso.com/projects/event-espresso-4/

Search for the translated term and it will show you something like this:

https://translate.eventespresso.com/projects/event-espresso-4/de/event-espresso-de_de/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=21852&filters%5Btranslation_id%5D=94004

So in this case, the string you are looking for is:

%1$sNote%2$s: Changes made in your Personal Information details will be synced with your user profile.


children-first

February 25, 2020 at 5:00 am

Hey Toni,

thank you very much, next time I will look there if something needs to be adjusted again.

Thank you so much 🙂

Best regards,
Simon


children-first

February 27, 2020 at 1:24 am

Hello everybody,
Hello Toni,

unfortunately I have another translation problem that I can’t get any further.

I have now added the payment method ‘PayPal Express’ to our event page. There is a translation here that I cannot find.

It is the translation in the following screenshot (marked in red)

The sentence is:
“After clicking ‘Finalize Registration’, you will be forwarded to PayPal website to Login and make your payment.“

However, I cannot find the sentence in the translations. I can only find the following:
https://translate.eventespresso.com/projects/event-espresso-4/de/event-espresso-de_de/?filters%5Bterm%5D=After+clicking+%27Finalize+Registration%27%2C+you+will+be+forwarded+to+PayPal&filters%5Buser_login%5D=&filters%5Bstatus%5D=current_or_waiting_or_fuzzy_or_untranslated&filter=Filter&sort%5Bby%5D=priority&sort%5Bhow%5D=desc
(“After clicking ‘Finalize Registration’, you will be forwarded to PayPal to make your payment. Make sure you return to this site in order to properly finalize your registration.“)

If I want to translate the sentence as it appears on the website, it doesn’t work.
The code for this is as follows:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
		"After clicking 'Finalize Registration', you will be forwarded to PayPal website to Login and make your payment." => 'Nachdem Du auf den Button ‚Ticket(s) jetzt buchen‘ geklickt hast wirst du zur PayPal Seite weitergeleitet. Dort musst Du Dich dann mit Deinem PayPal Account einloggen und die Zahlung durchführen.',
        // 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 );

I tested the code in different versions:
'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.' => 'Nachdem Du auf den Button ‚Ticket(s) jetzt buchen‘ geklickt hast wirst du zur PayPal Seite weitergeleitet. Dort musst Du Dich dann mit Deinem PayPal Account einloggen und die Zahlung durchführen.',
"After clicking 'Finalize Registration', you will be forwarded to PayPal website to Login and make your payment." => "Nachdem Du auf den Button ‚Ticket(s) jetzt buchen‘ geklickt hast wirst du zur PayPal Seite weitergeleitet. Dort musst Du Dich dann mit Deinem PayPal Account einloggen und die Zahlung durchführen.",

For testing purposes only, I also tested the sentence from your translation page with the different variants.
'After clicking 'Finalize Registration', you will be forwarded to PayPal to make your payment. Make sure you return to this site in order to properly finalize your registration.' => 'Nachdem Du auf den Button ‚Ticket(s) jetzt buchen‘ geklickt hast wirst du zur PayPal Seite weitergeleitet. Dort musst Du Dich dann mit Deinem PayPal Account einloggen und die Zahlung durchführen.',

I’m not finding my code error right now, can you help me?

Many thanks in advance!

Best regards,
Simon


children-first

February 27, 2020 at 1:41 am

After I wrote the message, I found the solution…
The text does not have to be translated in the function.php, but the display is included in the PayPal Express settings (Event Espresso -> Payment Methods -> PayPal Express -> Description).

Best regards,
Simon


Tony

  • Support Staff

February 27, 2020 at 5:56 am

Hi Simon,

The text does not have to be translated in the function.php, but the display is included in the PayPal Express settings

Correct.

To explain further, some strings are saved to the database and only translated on activation. So if you have the translation in place when EE was installed the above would have been translated.

After that, it is available in the admin so we can’t translate it afterwards.

This is true for pretty much all of the fields for payment methods and message templates.


children-first

February 28, 2020 at 12:17 am

Hi Tony,

thank you 🙂

Viewing 6 reply threads

The support post ‘Translation of a sentence in checkout page’ 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