Replies: 1
Hi there,
I’m the developer of a popular plugin to adapt WooCommerce to the german market (https://wordpress.org/plugins/woocommerce-germanized/). I’m very often facing issues with WPML and specifically with WooCommerce Multilingual as the translation options for third party developers seem to be “hacky” and error prone and not well documented (at least for Woo specific things).
Currently I’m trying to fix email translation. There seems to be an error within the way strings (specifically those for payment gateways) are translated within emails. Here are the steps to reproduce the issue:
1. Create an order in a language differing from your base language
2. Resend order details email in WP-Admin
The result is that payment instructions are not translated to the language chosen by the user (buyer). All other strings within the email are translated correctly. The problem seems to be that WCML_Currencies_Payment_Gateways::add_hooks initializes the Woo payment gateways on load so that dynamically switching the language within the emails doesn’t change the string translation for the gateways.
Furthermore the current language is set to a fixed value in WCML_WC_Gateways which will prevent any dynamic translation.
The problem with the bug is, that every third party developer who (re)sends custom (order) emails from non-checkout-endpoints will face this issue as the refresh_email_lang method in WCML_Emails won’t work as expected.
Just a general hint: Maybe it would be good to move plugin development to GitHub so that other developers can submit pull requests and issues to improve this plugin and it’s compatibility.
Another issue: You are adding some nice filters to allow email field translations in the Woo settings (e.g. wcml_emails_options_to_translate in WCML_Emails). The problem is that you are checking the section name in $_GET in line 530. Every plugin author who uses prefixes for their Email classes (which is expected from a plugin developer) will miss out as this only works for core email classes. Maybe you could add another filter for the section name?
Cheers,
Dennis