This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic is split from https://wpml.org/forums/forum/english-support/
This topic contains 6 replies, has 2 voices.
Last updated by peterP-63 2 years, 6 months ago.
Assisted by: Bigul.
Author | Posts |
---|---|
May 4, 2022 at 2:10 pm #11152089 | |
peterP-63 |
Hello there! Our Woocommerce Shop runs in German and English language. Is there a way to translate text given in snippets to another language? thanks, |
May 4, 2022 at 2:22 pm #11152239 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hi Peter, Welcome to the WPML support forum. I will do my best to help you to resolve the issue. Hope you have added this code to the functions.php of your theme. If so, please try the following steps after a full site backup and make sure the issue exists or not. 1) Visit WPML>>Theme and plugins localization page Please refer to the following documentation for more details. -- Bigul |
May 6, 2022 at 8:02 am #11165405 | |
peterP-63 |
Hi Bigul, thanks for your suppor! By following your advise I cannot find the Code Snippet plugin nor the text to be translated in WPML search options!? |
May 6, 2022 at 10:18 am #11166303 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hi Peter, Thank you for the updates. In this case, you can use WPML hooks(wpml_register_single_string & wpml_translate_single_string) for registering strings for translation and retrieving the translation. Please check the following sample code and documentation links for more details. $str = "Sorry, All sold out!"; do_action( 'wpml_register_single_string', 'WooCommerce', 'Sold Out', $str ); $str = apply_filters('wpml_translate_single_string', $str, 'WooCommerce', 'Sold Out' ); https://wpml.org/wpml-hook/wpml_register_single_string/ https://wpml.org/wpml-hook/wpml_translate_single_string/ -- Bigul |
May 7, 2022 at 2:54 pm #11173221 | |
peterP-63 |
Hi Bigul, Thanks for your advises! I finally succeeded by installing "Woody Code Snippets 2.4.4" plugin which is claimed to be compatible with WPML. Now the text from the code is translated and correctly shown on German site 🙂 However I realized that translation is not shown any more when I uncheck "string-tracking"! How can I manage that??? thank you, |
May 8, 2022 at 12:20 pm #11175341 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hi Peter, Thank you for the updates. When the Tracking strings option is enabled it will consume more memory, so not recommended on the live site. Please note that the *Woody Code Snippets * plugin is not included on the WPML official compatibility list for the Plugins - https://wpml.org/plugin/. It does not mean that this plugin is not compatible with WPML, but our compatibility team has not tested it yet. When we are using a snippet plugin it is storing the code in the Database, instead of files like plugins or themes. Therefore please use hooks(wpml_register_single_string & wpml_translate_single_string) for registering strings for translation and retrieving the translation. Refer to the following documentation for more details. https://wpml.org/wpml-hook/wpml_register_single_string/ https://wpml.org/wpml-hook/wpml_translate_single_string/ -- Bigul |