This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is trying to translate the 'Roles:' string from the Genesis theme, which is added via the functions.php file. The string is not appearing in WPML's String Translation search even after scanning the theme and child theme.
Solution:
1. Enable the 'Look for strings while pages are rendered' option in WPML >> String Translation page.
2. Visit the page where the string appears on the front end.
3. Return to the WPML >> String Translation page and search for the 'Roles:' string.
4. Translate the string and then disable the auto-registration option.
If this does not resolve the issue, install the String Locator plugin (https://wordpress.org/plugins/string-locator/) and search for the text in theme or theme bundled plugins files. Ensure the 'Roles:' string is wrapped in the gettext function, as detailed in the documentation (https://wpml.org/documentation/support/translating-the-theme-you-created/#wrap-all-texts-in-gettext-calls).
Alternatively, replace the existing code in functions.php with:
/* Add Trustee Roles to Trustee Single pages*/<br />add_filter( 'genesis_post_meta', 'monochrome_display_custom_tax' );<br />function monochrome_display_custom_tax($post_meta) {<br /> $roles_string = __('Roles:', 'themedomain');<br /> $post_meta = '[post_terms taxonomy="trustee_role" before="'.$roles_string.' "]';<br /> return $post_meta;<br />}
Then, scan the theme again and translate the 'Roles:' string via WPML >> String Translation page.
If the solution provided here does not resolve your issue, or if it seems outdated or irrelevant to your case, we 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. If needed, please open a new support ticket at WPML support forum for further assistance.
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/topic/translating-words-embedded-in-a-custom-template/
This topic contains 4 replies, has 0 voices.
Last updated by 4 days, 2 hours ago.
Assisted by: Noman.