Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are unable to translate custom elements in your theme that are not part of the standard text content using WPML.
Solution:
1. Navigate to WPML >> String Translation and enable the 'Look for strings while pages are rendered' option in the Auto register strings for translation section.
2. Visit the page on the front end where the string appears.
3. Return to the WPML >> String Translation page and search for those strings individually.
4. Translate the string.
5. After translating, uncheck the auto-registration option.
If these steps do not resolve the issue, increase the WP Memory Limit in your wp-config.php file by adding:

/* WP Memory Limit */<br />define('WP_MEMORY_LIMIT', '256M');

Place it before the line:

/* That's all, stop editing! Happy blogging. */

For strings added via Elementor or theme options, follow the steps in the WPML documentation for translating texts in admin screens and using the String Translation page. For more details, visit: Translating Elementor templates and Translating texts in theme.

If the solution provided here does not apply because it is outdated or not relevant to your case, 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 at 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.

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Noman 11 months, 1 week ago.

Assisted by: Noman.

Author Posts
September 14, 2024 at 12:40 pm #16178667

romanG-3

Background of the issue:
I'm working on a website translation, using WPML CMS and string translation components. The site I need help with is hidden link. I've already installed string translator too.

Symptoms:
I can't find a way to translate custom elements which are not a part of a standard text content of the website. The attached image shows examples of these custom elements. Here is the link to the image with examples of such elements: hidden link

Questions:
How do I translate custom theme elements using WPML?

September 15, 2024 at 8:23 am #16179444

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. If these strings are coming from theme/plugin files or theme/plugins options page then you should be able to translate it from WPML >> String Translation page by following the below steps:

1. Go to the WPML >> String Translation page and in the Auto register strings for translation section, enable the ‘Look for strings while pages are rendered’ option.
2. Re-visit the page on the front end where the string appears.
3. Re-visit the WPML >> String Translation page and search for those strings one by one.
4. Translated the string.
5. After translating the string, unchecked the auto-registration option.

If the above steps don’t help, please add the debug report in the Debug Information box. I have also enabled debug info box for your next reply: https://wpml.org/faq/provide-debug-information-faster-support/

Additionally, please disable the Maintenance mode for a moment so that I can examine the source code and try to see how these strings are added in the default language.

Thank you

September 15, 2024 at 2:05 pm #16180164

romanG-3

Hi Noman, and thanks for your reply. I've disabled the maintenance mode so you could have a look. I've also included debug info and trying to follow your steps.

kind regards
roman

September 15, 2024 at 2:20 pm #16180174

romanG-3

Update: I've followed your instructions:

1. Go to the WPML >> String Translation page and in the Auto register strings for translation section, enable the ‘Look for strings while pages are rendered’ option.
2. Re-visit the page on the front end where the string appears.

...and did not find a single string on the entire website (as per the settings, they're suppose to be highlighted with yellow)

kind regards
roman

September 15, 2024 at 4:23 pm #16180399

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for following the above steps. Could you please follow the below steps and let me know how it goes:

1. The current WP Memory Limit on your site is 40MB. The WP memory limit needs to be increased, it's different from PHP memory. PHP memory is fine but WordPress uses 40MB as default in your site. The minimum requirements for WPML are 128MB: https://wpml.org/home/minimum-requirements/

Please add this line to your wp-config.php file to increase WP memory, wp-config.php file is located in the root of your WP install:

/* WP Memory Limit */
define('WP_MEMORY_LIMIT', '256M');

You can add it anywhere in your file. I recommend placing it right before the following line:

/* That's all, stop editing! Happy blogging. */

2. I’ve noticed that the form and Popular Searches strings section are added using Elementor page builder so you should be able to translate that section either using the default WP Editor or WPML Translation Editor.

Here is a doc for more details: https://wpml.org/documentation/plugins-compatibility/elementor/#translating-elementor-templates

3. If you have added the “Post a job” string from theme options/customizer then you should be able to translate it by following the below steps:
- Go to WPML >> String Translation page.
- Scroll down and click on the Translate texts in admin screens » link at the bottom of the page.
- Search for the required string.
- Select the string.
- Click on the Add to String Translation button.
- Then click on the "« Return to String Translation" link.
- Add the translation from WPML >> String Translation page.

If the issue persists, I suggest you please install the String Locator plugin and search that text in theme or theme bundled plugins files and make sure the “Post a job” string is wrapped in gettext function. Here is a doc for more details: https://wpml.org/documentation/support/translating-the-theme-you-created/#wrap-all-texts-in-gettext-calls

Please let me know the results,
Thank you for your cooperation

September 16, 2024 at 9:01 am #16182283

romanG-3

Thaks, Noman! I've added the wp memory snippet and the required strings started to pop up in the string translation.

Have a good day!
roman

September 17, 2024 at 11:00 am #16187732
romanG-3

Hi Mo, I've encountered another issue, which is:

1) I translate some strings and the translation is updated, but not reflected on the front end (screencast link below)
2) The plugin does not see some strings (screencast link below)

hidden link

Please mark this ticket as private so i could share the admin link. Thanks.

Please help me fix the issue.
thanks.

New threads created by Noman and linked to this one are listed below:

https://wpml.org/forums/topic/translation-not-reflecting-on-front-end-and-missing-strings-in-wpml/

September 18, 2024 at 6:32 am #16191138

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Apologies for the delay in response, as I was off yesterday due to our national holiday. For the translation doesn’t show a frontend issue, it’s a different issue and will be handled separately as per our support policy. I've created a new ticket for this at: https://wpml.org/forums/topic/translation-not-reflecting-on-front-end-and-missing-strings-in-wpml/

If the original issue is solved please mark this ticket as resolved.

Thank you for your cooperation and patience