This thread is resolved. Here is a description of the problem and solution.
Problem:
The client created a custom function to simplify adding translations in their code, but the translations are not being picked up by WPML's scanning process because the function does not use the standard format recognized by WPML.
Solution:
1. Ensure that the text domain is passed as a string directly in the translation functions, as using variables or constants can prevent WPML and other tools from correctly recognizing the text domain. For more details, see the WordPress developer resources on internationalization: Internationalization guidelines.
2. To manually register strings that are not picked up automatically, use the
wpml_register_single_string
action. This is particularly useful for dynamic text strings such as user inputs. For more information on how to use this action, visit: wpml_register_single_string documentation.
3. To retrieve a string translation, refer to the
wpml_translate_single_string
action. Documentation can be found here: wpml_translate_single_string documentation.
If this solution does not apply to your case, or if it seems outdated, we recommend opening 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, please visit our support forum: WPML 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.