Skip Navigation

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.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Mihai Apetrei 1 year, 3 months ago.

Assisted by: Mihai Apetrei.

Author Posts
October 6, 2023 at 8:13 am #14525143

rutgerv-8

Tell us what you are trying to do?
We've added a button, at every categorypage, via some extra code in the functions.php file of our childtheme. We would like to translate the text: 'lees meer':
//Add 'Read more' button
$("#main .term-description").after( "<div class='read-more-wrapper' style='display: block; position: absolute; bottom: 0; width: 100%; margin: 0; background-image: linear-gradient(rgba(255,0,0,0), white 50%);'><button class='read-more button primary' style='margin: 60px 0 0 0; font-weight: 300;'>Lees meer</button></div>" );
}

I've tried the following things to get the string into the translation manager:
1. Lokalization of the theme 'lichtgeluidhurenin'. I see the text in the source, but it's not added as a string for translation.
2. Automatically recognize strings for translation (search for strings while pages are being displayed).
3. Looked for it in admin-string

Can you help me to translate this string?
hidden link

Button.JPG
October 6, 2023 at 7:41 pm #14530939

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+02:00)

Hi there.

Please make sure you are following our guides and also that you are following WordPress's instructions on how to localize scripts.

https://developer.wordpress.org/reference/functions/wp_localize_script/

https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/

Also, please note that we are not able to provide support for custom work within this support forum which will be required for translating content from inside Javascript/jQuery. Custom work falls out of the purpose of our Support Policy.

In this case, the code that you shared is adding content to the site dynamically, by using jQuery (a Javascript library) so I did my best to point you in the correct direction.

If my directions are not enough I suggest contacting one of our 3rd party contractors that specialize in custom work with WPML (https://wpml.org/contractors/) or a developer of your choice.

I hope that you will find this answer insightful and helpful.

Mihai Apetrei