Skip Navigation

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

If you are using a custom made theme or plugin, you may not see the strings you want to translate in String Translation.

If you developed the custom theme and plugin, start by making sure that your texts are properly internationalized.

If you are using a custom theme or plugin, you can contact the theme or plugin developer and confirm if the texts are translatable. If they are, you can then visit our page about finding strings that don't appear in String Translation. This page includes step-by-step text and video tutorials about translating different types of strings.

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 6 replies, has 2 voices.

Last updated by Bigul 1 year, 6 months ago.

Assisted by: Bigul.

Author Posts
July 14, 2023 at 10:14 am #14039137

patriziaA-2

Tell us what you are trying to do?
I'm trying to translate strings in my custom made wordpress theme.
WPML was able to detect strings but when I translate them they were not showing up in the front-end.
Then, following a guide found in your support, I went in the "String translation" menu and deleted the strings that were already translated but not showing.

The problem now is that WPML is unable to find those strings anymore.
I go in "theme localization" and scan for strings in the theme, but they don't show up anymore.
I deleted and uploaded the theme again, nothing.

Any help?

Is there any documentation that you are following?
https://wpml.org/it/faq/why-arent-my-translated-strings-showing-up-on-the-front-end-of-my-site/

Is there a similar example that we can see?

What is the link to your site?
hidden link

July 14, 2023 at 2:32 pm #14040443

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

Please visit WPML>>String Translation after a full site backup and enable the *Look for strings while pages are rendered* option of *Auto register strings for translation* section(on the bottom of the screen).

Then visit the frontend pages and go back to WPML>>String Translation to check whether the strings are registered for translation or not.

This option will be disabled in a couple of hours automatically. But will help us to track the issue in similar cases.

https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#auto-register-strings-for-translation

If the issue exists, please share the code you are using to display one of the strings having the issue.

--
Thanks!

Bigul

July 14, 2023 at 3:37 pm #14040691

patriziaA-2

Hi, I've just done that, but no strings are registered when I visit pages in the front end.

In the image attached the code of one of the string that should be translated: in this case it's just a static H1 title for the homepage hero.

Screenshot 2023-07-14 alle 17.35.20.png
July 14, 2023 at 4:00 pm #14040769

patriziaA-2

Everytime I go to "theme localization" and scan for strings in the theme, it says:

"Scan successful! WPML found 98 strings. They have been added to the string translation table."

Always 98. I can do it 10 times in a row, it always says 98.
But nothing is added to the string database.

I even tried to force-reset WPML but nothing changed after the set up.

Since I deleted the strings as your guide said, I'm not able to make it discover anymore.

July 14, 2023 at 4:28 pm #14040811

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the updates. Please share the theme code to list that H1 title, it will help us to track the issue.

Also, please tries the following troubleshooting steps after a full site backup{mandatory} and make sure the issue is existing or not.

1) Go to WPML>>Support page, click on the Troubleshooting link (blue link in the middle of the page)

2) On the Troubleshooting page, please click on the following options of the *Clean up* section. Wait for confirmation of processing after each one.

- Clear the cache in WPML
- Remove ghost entries from the translation tables
- Fix element_type collation
- Set language information
- Fix WPML tables collation
- Assign translation status to duplicated content
- Fix terms count
- Fix post type assignment
- Cleanup and optimize string tables
- Show custom MO Files Pre-generation dialog box>>Generate .Mo files

3) Scan for the theme strings again from the Themes & Plugins localization

--
Thanks!

Bigul

July 14, 2023 at 4:48 pm #14040969

patriziaA-2

Unfortunately, even after following your instructions and cleaning up everything you told me, I'm still unable to scan new strings from my theme.

The strangest thing is that before deleting those strings, WPML was able to detect them. I think there were ~400 strings in my theme.
But now it doesn't detect anything.

At the following link you'll find the entire code of my theme.
Let me know if it helps:
hidden link

July 15, 2023 at 8:09 am #14042057

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the details and theme files. I went through the code. The strings are not registering for translation because the code is not following the WordPress localization standards and also the strings are dynamic. So it will not be possible for WordPress and WPML to recognize these strings. Please refer to the following code & documentation for more details.

https://developer.wordpress.org/apis/internationalization/internationalization-guidelines/#basic-strings

https://wpml.org/documentation/support/translating-the-theme-you-created/

<h3 class="h3-home" data-text="tn4a821f0a"><?php echo _u('tn4a821f0a','text'); ?></h3>

There are multiple calls for the _u() function in your theme. So the best option will be you can use the following WPML hooks to register & translate the strings inside the _u() function.

To register a Dynamic String - https://wpml.org/wpml-hook/wpml_register_single_string/

To get the translated value of a Dynamic String - https://wpml.org/wpml-hook/wpml_translate_single_string/

Please consult about this with your theme developer. Because we have support limitations for the customized themes & plugins - https://wpml.org/purchase/support-policy/. Thank you for your kind understanding.

--
Thanks!

Bigul