Support

Home Forums Translations Translation not working using either Poedit or functions.php child theme code

Translation not working using either Poedit or functions.php child theme code

Posted: September 22, 2015 at 1:18 pm


Pixel Workshop

September 22, 2015 at 1:18 pm

Greetings friends!

I tried uploading a modified event_espresso-es_ES.mo file which didn’t seem to produced the desired changes, so I tried dropping this code into my child theme’s functions.php file, which still doesn’t seem to work.

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

When I saved the Child Theme’s functions.php file (using the WP theme editor) I noticed the error in my error log.

PHP Fatal error: Call to a member function is_espresso_page() on a non-object in /nas/wp/www/cluster-41960/hocomojo/wp-content/plugins/event-espresso-core-reg/core/EE_Maintenance_Mode.core.php on line 270, referer: http://hocomojo.org/wp-admin/network/theme-editor.php?file=functions.php&theme=CFHoCoChildTheme&scrollto=936&updated=true

This is a multisite set up and EE4 is enabled on a sub-site. Language is set to US English on both the network level and the site level.

Any thoughts on what might be causing this?


Josh

  • Support Staff

September 22, 2015 at 3:36 pm

It will likely work out better to add the function via FTP and text editor.


Pixel Workshop

September 22, 2015 at 5:13 pm

Thanks, Josh.

I went back and edited the child theme file via Coda and while there was no error in the log this time, its still not modifying the text. I thought that since neither the Poedit nor the child these technique worked, it could be pointing to something different than the code itself.


Pixel Workshop

September 22, 2015 at 5:15 pm

Would there be a difference between EE being network active and site by site active?


Pixel Workshop

September 22, 2015 at 5:36 pm

I tried it both way and the translation script still isn’t working.

The other odd thing is that I also have a script in the child theme to move the ticket selector below the content and that’s working just fine.


Tony

  • Support Staff

September 23, 2015 at 3:14 am

That is odd, can you post up the code you are using for the translation please?

We recommend adding it to something like http://pastebin.com/ and adding the url here.


Pixel Workshop

September 23, 2015 at 7:01 am

Hey Tony!

Odd is the nice word, we all looked at it and said, “bat-s**t crazy”


Pixel Workshop

September 23, 2015 at 7:02 am

Hmmm… thought I could get it to embed the pastebin

Here’s the link
http://pastebin.com/LfLuVTWW


Josh

  • Support Staff

September 23, 2015 at 7:46 am

Hi there,

Are you trying to translate the wording of the State/Province question? If so, the translation function isn’t necessary, and will not work post activation because EE will use what’s in the file and create that question in the database. So it could work if the translation function was in place before you first activate Event Espresso.

You can change the Question text for the State/Province question by going to Event Espresso > Registration Form, then under where it lists the State/Province question, click edit, and then you edit the first field, then save.


Pixel Workshop

September 23, 2015 at 9:38 am

Thanks, Josh. That was one of them, and I wasn’t thinking about re-naming the question, so that works for that.

I had stripped out the other changes from the functions.php file for simplicity sake when troubleshooting. The one change that’s most important right now is in the box on the registration form where you can tick a checkbox to copy primary registrant info to all the other registrant info. I need to change that copy.

‘%sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.’ => ‘%sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration. \n
\n
Tickets can be donated back to the Foundation by filling in First and Lsat name with the word “DONATE” and email with your email address. All fields must be filled in at this time with a name or “GUEST”. Individual Attendee names can be changed at a later date.’,


Lorenzo Orlando Caum

  • Support Staff

September 23, 2015 at 10:38 am

Hi there, this is our new resource which explains how to translate Event Espresso:

https://eventespresso.com/wiki/how-to-translate-event-espresso/

Initially, it sounded like you were trying to translate Event Espresso into another language but it I think you are wanting to make changes to the messaging in certain areas.

Your original attempt did not work as that file was for Spanish (Spain) and your site is set to English. They would need to match for the translation to work. For example, your site would need to be in Spanish for the Spanish (Spain) mo file to work.

For your most recent question, it isn’t working as the language string is incomplete. This is the entire string:

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.

The easiest way to find these strings would be to search for a couple words in GlotPress like this:

http://translate.eventespresso.com/projects/event-espresso-4/en/event-espresso-en_US?filters%5Bterm%5D=This+option+allows+you+to+use+the+above+information+for+all+additional+attendee+question+fields.+%25sPlease+note%3A%25s+some+events+may+have+additional+questions+that+you+may+still+be+required+to+answer+in+order+to+complete+your+registration.&filters%5Buser_login%5D=&filters%5Bstatus%5D=current_or_waiting_or_fuzzy_or_untranslated&filter=Filter&sort%5Bby%5D=translation&sort%5Bhow%5D=asc


Lorenzo


Pixel Workshop

September 23, 2015 at 12:13 pm

Hi Lorenzo,

Ahhhh…. that makes sense. I didn’t realize I needed the whole existing string. And it worked!

Thanks to you, Josh, and Tony for puzzling through this with me. As always, you guys are AWESOME!

Warmly,
ilana


Tony

  • Support Staff

September 23, 2015 at 12:26 pm

You’re most welcome, ilana 🙂

You’re feedback is much appreciated, I have passed it onto the rest of the team.

Just let us know if you have any further problems, even the odd ones 😉

The support post ‘Translation not working using either Poedit or functions.php child theme 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