How to translate
-
How can I translate the “Checkbox label text” text?
It doesn’t seem to come up in Loco Translate nor with TTfP.
Thanks
-
Is there a way to translate the text?
Hi @guymal,
Thanks for your message! Sorry for the delayed response.
I have just checked if this string “Checkbox label text” exists in the Loco Translate plugin on my sandbox site.
It appears to be there.
If you are using WP Sendfox plugin from the older version, then you can be seeing the older translation file there. Have you tried to click on the “Sync” button to synchronize your translation file with the latest source?
Thanks for your response.
I need to translate the actual text that is displayed to the user, not the text in the WordPress interface. Basically to have the ability to translate the text value that I put in the “Checkbox label text” field in the plugin’s settings.
How do I do that ?
Thanks
Do you have a multi language website? What plugin do you use to provide multiple translations for your website?
Yes, I use Polylang.
I also have TTfP which lets you translate strings that are in plugins.
I see. I am not so familiar with Polylang. But does it allow translating strings in the wp_options table? I know that WPML allows it for example.
The string you would like to translate is stored in the option gb_sf4wp_options[woocommerce-checkout][label]
From what I can tell it doesn’t let you translate strings from wp_options table
Here’s how TTfP works: https://wordpress.org/plugins/theme-translation-for-polylang/ maybe it’s something that’s easy to add support for?
Thanks
I think I know how you can do it:
If you add this to wp-sendfox.php:
if (function_exists('pll_register_string')) { pll_register_string('checkoutlabel', 'subscribe to our newsletter'); }and then add change to this where you use the string:
$form['label'] = pll__('subscribe to our newsletter');If the label is kept empty in the admin it should work (the translation will be in Polylang).
You’d probably need to also check if pll__ also exists before calling it.
I updated wp-sendfox.php to handle this, would you like me to send you the file?
Thanks for your input! I don’t think I would’ve been able to implement this so fast myself. Yes, please, share the file and let me know which line to look at.
Here’s the updated wp-sendfox.php file:
You can see I added a string for the checkbox label and in your init function gb_sf4wp_init I check if there’s a translation and if so, take it from there.
Then I just use that string in the 3 places where you look at $form[‘label’].
Thank you very very much @guymal!
I have downloaded your code.
Cool, looking forward to a plugin update that supports this so I can get rid of my custom file @bogdanfix
Thanks!
The topic ‘How to translate’ is closed to new replies.