Support

Home Forums Event Espresso Premium Translation of [ESPRESSO_MY_EVENTS] sublines

Translation of [ESPRESSO_MY_EVENTS] sublines

Posted: April 18, 2016 at 9:19 am


ardiaful

April 18, 2016 at 9:19 am

I’m having some trouble translating the sublines in [ESPRESSO_MY_EVENTS] shortcode. I mean the lines beneath the events table with the colored squares on their left.

The problem is that because each subline is made of separate words (not a full sentence) the tranlation of each word individually does not make sense in Spanish. i.e “Approved Registration” is not equal to “Aprobado Registro”, but “Registro Aprobado” with the words interchanged, and this means I need to change the order of the words. How could I get this translated?

Thank you!


Lorenzo Orlando Caum

  • Support Staff

April 18, 2016 at 11:20 am

Hello,

This should work:

https://gist.github.com/anonymous/ed81729c0bee464df3d9127028722588

If you have an existing gettext function in use, then you could just add the new entry and save changes.


Lorenzo


ardiaful

April 18, 2016 at 11:52 am

Where does this go? I paste it in functions.php and does not work.


Lorenzo Orlando Caum

  • Support Staff

April 18, 2016 at 1:13 pm

Hello,

It can go into a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/).

If you are already using a child theme which has some customizations, then you can add it there instead of creating a new site specific plugin.


Lorenzo


ardiaful

April 18, 2016 at 2:15 pm

There is something wrong with the code. After adding the code in my customizations plugin, the website simply gets blank.

My plugin code is now this:

<?php
/*
Plugin Name: Site plugin for conoceris.com
Description: Site specific code for conoceris.com
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */

function ee_custom_messaging_changes( $translated, $original, $domain ) {
    $strings = array(
        'upcoming' => 'Próximamente',
        'Upcoming' => 'Próximamente',
    );
    if ( isset( $strings[$original] ) ) {
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
	}
    return $translated;
}
add_filter( 'gettext', 'ee_custom_messaging_changes', 10, 3 );

//* Change the order of the label content for the my events page
function ee_custom_messaging_my_events_page( $translated, $original, $domain ) {
    $strings = array(
        '%s Registration, %s Event' => 'Registration %s, %s Event',
    );
    if ( isset( $strings[$original] ) ) {
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
}
add_filter( 'gettext', 'ee_custom_messaging_my_events_page', 10, 3 );

/* Stop Adding Functions */


Tony

  • Support Staff

April 19, 2016 at 1:44 am

Hi ardiaful,

I’ve just tested that plugin on a test site and it works fine.

I’m guessing you have another snippet of code doing similar with the same function name. If you enable WP_DEBUG and activate that plugin you should see the error on the white page.

However, one thing to note is that all of those gettext translations can actually be included within a single function. So that additional single line translation can be added to your ee_custom_messaging_changes() function so the whole plugin becomes:

 'Próximamente',
		'Upcoming' => 'Próximamente',
		'%s Registration, %s Event' => 'Registration %s, %s Event',
	);
	if ( isset( $strings[$original] ) ) {
		$translations = get_translations_for_domain( $domain );
		$translated = $translations->translate( $strings[$original] );
	}
	return $translated;
}
add_filter( 'gettext', 'ee_custom_messaging_changes', 10, 3 );

/* Stop Adding Functions */


ardiaful

April 19, 2016 at 2:21 am

Yes, this worked fine for ‘%s Registration, %s Event’ => ‘Registration %s, %s Event’.

However, I still have the same problem for ‘Status, Event’, that should change to ‘Evento, Status’ (i.e. ‘Sold out event’, to ‘event sold out’). How can I solve this?

Finally, regarding the icons below in my_events page, I cannot see the one for “edit the registration details” (only can read the text line), and the icon & text line for the invoice is lost. Hope you can help to visualize these two.

Thank you in advance.


Tony

  • Support Staff

April 19, 2016 at 4:59 am

However, I still have the same problem for ‘Status, Event’, that should change to ‘Evento, Status’ (i.e. ‘Sold out event’, to ‘event sold out’). How can I solve this?

Where do you see those strings?

Can you add a screenshot so we can see please?

Finally, regarding the icons below in my_events page, I cannot see the one for “edit the registration details” (only can read the text line), and the icon & text line for the invoice is lost. Hope you can help to visualize these two.

Can you see the other icons?

For example can you see the resend confirmation email link? – http://take.ms/eeRMr

Invoice/Receipt links are only shown the primary registration within the group, so do you see those links on that?


ardiaful

April 19, 2016 at 9:01 am

See attached a screenshot for the text lines that I need translated:
Lines pending translation

As I said befores, this are separate words and I need them with the order changed: i.e. Active Event = Evento Activo

Regarding the icons, I particularly cannot see invoice icon in the front page (legends)

Invoice icon is not shown in legend


Lorenzo Orlando Caum

  • Support Staff

April 19, 2016 at 10:10 am

Hello,

You can adjust the order like this:

https://gist.github.com/anonymous/f61da000b2e5570b24afc25f85165786

If you compare that to the original, then you’ll see that the placeholders have changed in position.


Lorenzo


ardiaful

April 19, 2016 at 10:28 am

Thanks, that solved much of the translation issue. However, there are still 3 text lines getting tough. Please check out screenshot.


Lorenzo Orlando Caum

  • Support Staff

April 19, 2016 at 1:57 pm

Hello,

What are the phrases that are not translating?


Lorenzo


ardiaful

April 20, 2016 at 1:51 am

It seems that screenshot was not added in my last message. Please check it out now here: http://i.imgur.com/7liyKIG.png

The phrases to translate are:
“No Approved Registration” = “Registro No Aprobado”
“Inactive Event” = “Evento Inactivo”
“Postponed Event” = “Evento Pospuesto”

Additionally, the invoice icon does not show up among the legend icons and I’d like to display it, how could I get this done?

Thanks
Francisco


Tony

  • Support Staff

April 20, 2016 at 4:02 am

You’ll need to add some additional strings to your translation plugin:

“Inactive Event” = “Evento Inactivo”
“Postponed Event” = “Evento Pospuesto”

Are output using ‘%s Event’, so you need:

'%s Event' => 'Event %s',

“No Approved Registration” = “Registro No Aprobado”

Is output using ‘%s Registration’, so for that you need:

'%s Registration' => 'Registration %s',

That should translate the remaining strings.


ardiaful

April 20, 2016 at 5:13 am

I got this finally translated. Thank you for your committed support!

Finally, I’d just like to show the invoice icon among the icons legends as this is the only one left to display. In particular I mean this icon:

http://i.imgur.com/3Et1YQC.png


Lorenzo Orlando Caum

  • Support Staff

April 20, 2016 at 6:56 am

Hi,

It looks like when we introduced the invoice link, we overlooked making an addition for the legend.

We will get that added and this will be available as a one-click update for the next version of the WP user integration add-on


Lorenzo

The support post ‘Translation of [ESPRESSO_MY_EVENTS] sublines’ 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