This thread is resolved. Here is a description of the problem and solution.
Problem:
You are trying to translate custom strings in your child theme using WPML, but the translation for 'How It Works' is not appearing on the front end, despite using the
icl_register_string
function and adding translations in the WPML String Translation section.
Solution:
The issue arises because the
gettext
function is not correctly implemented; it lacks a text-domain. You should modify your code to include the text-domain, like this:
__('How It Works', 'my-theme-domain');
Additionally, instead of using
icl_register_string
, we recommend using the
wpml_register_single_string
action and then retrieve the string translation with
wpml_translate_single_string
. For detailed guidance on using gettext, visit How to Use Gettext, and for more on registering strings, see WPML register single string.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, please open a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, you can contact us directly through our support forum.
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 contains 1 reply, has 0 voices.
Last updated by 2 months, 2 weeks ago.
Assisted by: Andrey.