WooCommerce Optin Label i18n

Your woocommerce does not offer any options to translate strings. Especially, the labels are not translatable:
https://plugins.trac.wordpress.org/browser/woocommerce-sendinblue-newsletter-subscription/trunk/src/managers/cart-events-manager.php#L335

Please wrap the string in that line in i18n functions. If you have a public github repo, i will happily provide a pull request.

The web is filled with issues regarding this and no solution provided so far. Even the wordpress support forum mentions this. It is a simpe fix which is very much needed for multilang shops.

if you need help with the implementation let me know.

copying @Fibo here: maybe you know a bit about this?

Hi, to my understanding you want the checkout label wrapped in __($label, 'wc_sendinblue') with an appropriate text domain like wc_sendinblue here, so you can use your i18n translations, correct?

Thanks for your suggestion! For now the repo is not public i’m afraid.
Any other strings where you are acutely limited due to this?

Exactly i just need to translate this label. Did not find any other strings so far

Hi @JUVOJustin, we applied the translation framework to the label in our 4.0.7 release. Please try again and let me know if there are further issues. Thanks!

2 Likes

@Fibo i checked and the update does not solve the issue. You cannot wrap variables in __(‹  â€ş, ‹  â€ş) functions.

Basically this code has to be:

if (!empty($settings[SendinblueClient::DISPLAY_OPT_IN_LABEL])) {	           
    return $settings[SendinblueClient::DISPLAY_OPT_IN_LABEL];
}
 return __('Add me to the newsletter', 'wc_sendinblue');

This still has a conceptual problem. As far as i can tell brevo is not natively supporting multilang.

Therefore, it does not make sense to set the label in brevo if the whole point is to allow translating it. Basically, the code will short circuit if the label is set in brevo making the translation not show up.

In my opinion it is perfectly fine to just use the translatable hardcoded string since advanced WordPress users are used to use tools like polylang or wpml to translate and change strings.

1 Like