Support

Home Forums Translations Translatepress with EE Messages

Translatepress with EE Messages

Posted: October 8, 2019 at 3:14 pm


Tom Marley

October 8, 2019 at 3:14 pm

I’ve been using Translatepress so that I can have Event Espresso Multi-Lingual. It has worked well so far for all front-end translations however I am having some issues with the messages.

Translatepress uses shortcodes for admin edited messages ie. [trp_language language=”en_GB”]English language content[/trp_language]

When I save the message, these shortcodes disappear, presumably because they are not EE shortcodes. Is there any way of allowing these shortcodes in so that I can have emails in multiple languages?

Thanks.


Josh

  • Support Staff

October 8, 2019 at 3:58 pm

Hi Tom,

I’m afraid that even if those shortcodes were allowed to stay in the email template, how would the email know which language content to display/not display?

Adding support for multilanguage shortcodes into emails would require building out some custom email shortcodes at the very least as a wrapper for TranslatePress shortcodes. Even with the custom shortcodes I’m not sure how the emails will know which language to display.


Tom Marley

October 9, 2019 at 4:04 am

Thanks for the reply Josh. I’m not sure how exactly it works, I imagine it adds the php wrapper to the text.

Would it be an option to manually insert the php tag into the files?

Here’s the description they provide: https://translatepress.com/docs/translation-shortcode/


Tony

  • Support Staff

October 9, 2019 at 5:42 am

When a plugin is updated in WordPress, it basically removes the current version completely, downloads the new version and extracts it in place of the original.

That means any customizations you do to files within a plugin will be lost each time that plugin updates so it’s not the correct way to add custom functionality (hooks are).

However, the problem is not getting the custom functionality into the templates themselves (the custom shortcodes above could be used for it), the problem is on the request to generate the emails I don’t think get_locale() will return the correct language used (assuming TranslatePress is filtering it which it appears to be).

The shortcodes basically pull the current locale using get_locale() and then output the content for that locale by using multiple blocks:

[trp_language language=”en_US”] English content only [/trp_language]
[trp_language language=”de_DE”] German content only [/trp_language]

Add the shortcode is simple enough but I don’t think the language check will work.

Then the fact that details for events/datetimes/tickets etc that are all stored within the database in a single language and pulled directly into the emails from the default locations EE expects I’m not sure if this can be easily achieved.

The support post ‘Translatepress with EE Messages’ 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