Posted: 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?
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.
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/
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
The shortcodes basically pull the current locale using
[trp_language language=”en_US”] English 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.