Translating the checkbox label
-
Hi,
We have a bi-lingual store, and i’m trying to translate the opt-in checkbox label.
In the code I found this line (mailchimp-for-woocommerce\includes\class-mailchimp-woocommerce-newsletter.php; line 48):
$checkbox .= ‘<label for=”mailchimp_woocommerce_newsletter” class=”woocommerce-form__label woocommerce-form__label-for-checkbox inline”><span>’ . __($label, ‘mailchimp-woocommerce’) . ‘</span></label>’;
It seems to meant to make the label translatable, but the Loco Translate plugin is not indexing it (I guess because there is a var and no string as a first parameter).
I also tried using WordPress “option_(option name)” filter. It works outside the plugin scope, but not in it.
Am I missing something? If not, a fix will be great.
May I suggest this:
echo sprintf(_x(‘%s’, ‘newsletter label, ‘mailchimp-woocommerce’), $label)
sprintf() – maybe a better way to inject a var to a translation function.
_x() – translation function with a context parameter.Thanks,
Asaf
The topic ‘Translating the checkbox label’ is closed to new replies.