Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Hotel Booking Translate emails with TranslatePress
- This topic has 4 replies, 3 voices, and was last updated 5 months, 3 weeks ago by István Tornyos.
- AuthorPosts
- March 4, 2024 at 1:25 am #1581552István TornyosParticipant
Hello,
Has anyone tried to translate emails sent by hotel booking into another language using the TranslatePress translation plugin?
If so, could you please share your experience in this regard.
In principle, there is such a function in TranslatePress, but it doesn’t work for me, or I’m doing something wrong. I see that only the title and subject of the email can be translated, which would be enough, but that doesn’t work for me either.
Someone who has already used it could write how to translate at least the header and subject of the letter with this plugin.
Or would you suggest another solution for translating emails.
Thanks
IstvánMarch 14, 2024 at 7:28 am #1587552J. DavisKeymasterHi István,
Just a reminder that the Hotel Booking plugin is compatible with WPML so we recommend it for translating the content added with the Hotel Booking plugin. It allows translating emails as well.March 25, 2024 at 2:45 am #1593054István TornyosParticipantThanks.
June 20, 2024 at 2:18 am #1634199Joffrey NicoloffParticipantHello,
one workaround is to use the TranslatePress shortcode and allow shortcodes in Hotel Booking emails only.
Add this code to your child theme, custom plugin or snippet plugin :
It will allow shortcodes in Hotel Booking emails.add_action( 'mphb_before_send_mail', 'add_filter_a3w_mphb_wp_mail', 10, 1 ); add_action( 'mphb_after_send_mail', 'remove_filter_a3w_mphb_wp_mail', 10, 1 ); function add_filter_a3w_mphb_wp_mail( $mailer ) { add_filter( 'wp_mail', 'a3w_mphb_wp_mail', 10, 1 ); } function remove_filter_a3w_mphb_wp_mail( $mailer ) { remove_filter( 'wp_mail', 'a3w_mphb_wp_mail', 10, 1 ); } function a3w_mphb_wp_mail( $wp_mail ) { $wp_mail[ 'subject' ] = do_shortcode( $wp_mail[ 'subject' ] ); $wp_mail[ 'message' ] = do_shortcode( $wp_mail[ 'message' ] ); return $wp_mail; }
Now in Hotel Booking emails settings pages, you can use the TranslatePress shortcode
[trp_language language="en_US"]Your content only for english[/trp_language]
in each fields : Subject, Header and Email Template.TranslatePress documentation of shortcode here : https://translatepress.com/docs/restrict-by-language/translation-shortcode/
In my case, I’m using WPML but I made some tests with TranslatePress on one site using Hotel Booking and I’m sharing my results.
June 24, 2024 at 11:23 pm #1636154István TornyosParticipantThanks, I’ll try it.
- AuthorPosts
- You must be logged in to reply to this topic.