Plugin Support
Alex
(@alexcozmoslabs)
Hello,
The WooCommerce emails are actual templates (like theme files) so it means you can translate whatever is localized using gettext in them. https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
Our plugin doesn’t yet detects these strings because they are not visible in the front-end, only processed. The good new is that most languages already have these translated properly.
Alternatively, you can also use LocoTranslate in order to translate these strings.
A side note to take into account: while emails that get sent after a user action are translated correctly, out of order emails like reminders (if you use subscriptions) will always be sent in the default language as we don’t store the user language in order to know in what language we should send the email.
In order to translate an email that you customize in the WordPress admin you can use the Conditional Shortcode https://translatepress.com/docs/translation-shortcode/
You wrap the content for every language using the right shortcode and only the correct part will be emailed to the user.
Here’s an example of another plugin that has a similar email: https://translatepress.com/how-to-translate/charitable-plugin/ (scroll down to the bottom)
Best Regards,
Thanks! Will look into it.
Cheers.
Found the below posts via Googling, which suggest to add &wg_language=xx
to the URL. Perhaps it only works on that specific plugin though, cause I just tried on mine and it didn’t seem to work, sent emails still in site default language… to be continued
https://wordpress.org/support/topic/multi-language-emails-2/
https://wordpress.org/support/topic/woocommerce-order-emails-are-not-translated-except-the-very-first-email/
Plugin Support
Alex
(@alexcozmoslabs)
Hi,
Out of order emails will not be translated like renewal emails or follow-up ones. That’s because we don’t store the user’s initial language and change it when this email is being sent.
Thank you for understanding.
Kind Regards,
Thanks! I’ll look into other options/solutions.
Cheers.
Hey @loyukfai, I allow myself to jump in the discussion as I’m facing the very same issue. Did you find any workaround for this ? I feel it’d look not very pro to have a first email sent in english (second langage on my website) and next ones like saying the order has been sent, in French (default langage for me).
I hope you found a solution and can help me out here !
Best regards
Also, @alexcozmoslabs, is this issue something you plan on fixing on next updates of the plugin ?
Thanks !
-
This reply was modified 4 years, 3 months ago by
alexis888.
@loyukfai thanks for the quick feedback. I’ve taken a look at the other post and added a message but I feel like this issue will not be resolved before a while, if ever!
It seems in Weglot (and possibly WPML) there are more established workarounds.
There was some info at https://wordpress.org/support/topic/how-to-translate-email-string-using-translatepress/ but the replies have apparently erased.
Cheers.
Yeah i’ve seen the Weglot workaround but still, not ideal to ask my client to do that everytime he’ll have to update an order status on his store :/
Not to mention that Weglot is another translation plug-in and is not compatible with TranslatePress (pls correct me if wrong).
The issue is that TP doesn’t store the customer’s language in the database, so it has no idea what language to be used even if it wants to do the translation.
To modify this behaviour would require modifying the order database, and I’m not sure if TP team is interested in that.
For me a small box selecting the language in Woocommerce admin interface would suffice. Yes, it’s not ideal.
Me think you need to consider other options if you really want this function.
Cheers.
-
This reply was modified 4 years, 3 months ago by
loyukfai.
It’s crazy to see how many times something that should be an obvious WordPress / WooCommerce core feature makes every user struggle :/
There is actually a solution for that:
https://gist.github.com/dartrax/85b3ab77b8210e92cc50e1b68de83c73
With this additional code, the user language will be stored in the order metadata and the “out of order” emails will be sent in the correct language.
– dartrax
Wow this is super cool. Thanks a lot @dartrax. TP team can you merge this please?
Cheers.